diff --git a/pkg/dnfjson/dnfjson_test.go b/pkg/dnfjson/dnfjson_test.go index f3d84241cf..29e55b1f66 100644 --- a/pkg/dnfjson/dnfjson_test.go +++ b/pkg/dnfjson/dnfjson_test.go @@ -1,6 +1,7 @@ package dnfjson import ( + "encoding/json" "flag" "fmt" "os" @@ -662,3 +663,10 @@ func TestRequestHash(t *testing.T) { assert.Equal(t, 64, len(req.Hash())) assert.NotEqual(t, hash, req.Hash()) } + +func TestRepoConfigMarshalAlsmostEmpty(t *testing.T) { + repoCfg := &repoConfig{} + js, _ := json.Marshal(repoCfg) + // XXX: should we make the other bools also *bool ? + assert.Equal(t, string(js), `{"id":"","gpgcheck":false,"check_repogpg":false,"ignoressl":false}`) +} diff --git a/pkg/rpmmd/repository_test.go b/pkg/rpmmd/repository_test.go index 5ac270efed..38d9cab663 100644 --- a/pkg/rpmmd/repository_test.go +++ b/pkg/rpmmd/repository_test.go @@ -1,6 +1,7 @@ package rpmmd import ( + "encoding/json" "testing" "github.com/stretchr/testify/assert" @@ -26,7 +27,6 @@ func TestPackageSpecGetEVRA(t *testing.T) { assert.Equal(t, "3.3a-3.fc38.x86_64", specs[0].GetEVRA()) assert.Equal(t, "1:2.06-94.fc38.noarch", specs[1].GetEVRA()) - } func TestPackageSpecGetNEVRA(t *testing.T) { @@ -49,5 +49,10 @@ func TestPackageSpecGetNEVRA(t *testing.T) { assert.Equal(t, "tmux-3.3a-3.fc38.x86_64", specs[0].GetNEVRA()) assert.Equal(t, "grub2-1:2.06-94.fc38.noarch", specs[1].GetNEVRA()) +} +func TestRepoConfigMarshalEmpty(t *testing.T) { + repoCfg := &RepoConfig{} + js, _ := json.Marshal(repoCfg) + assert.Equal(t, string(js), `{}`) }