Use asserts in tests. Refs #309
This commit is contained in:
parent
72f8b07e8b
commit
b81580081b
3 changed files with 14 additions and 13 deletions
|
|
@ -11,6 +11,7 @@ import (
|
|||
"os"
|
||||
"os/exec"
|
||||
"testing"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"path"
|
||||
)
|
||||
|
||||
|
|
@ -39,13 +40,9 @@ func TestFetchChecksum(t *testing.T) {
|
|||
dir, err := setUpTemporaryRepository()
|
||||
defer func(dir string) {
|
||||
err := tearDownTemporaryRepository(dir)
|
||||
if err != nil {
|
||||
t.Errorf("Warning: failed to clean up temporary repository.")
|
||||
}
|
||||
assert.Nil(t, err, "Failed to clean up temporary repository.")
|
||||
}(dir)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to set up temporary repository: %v", err)
|
||||
}
|
||||
assert.Nilf(t, err, "Failed to set up temporary repository: %v", err)
|
||||
|
||||
repoCfg := rpmmd.RepoConfig{
|
||||
Id: "repo",
|
||||
|
|
@ -55,10 +52,6 @@ func TestFetchChecksum(t *testing.T) {
|
|||
}
|
||||
rpmMetadata := rpmmd.NewRPMMD(path.Join(dir, "rpmmd"))
|
||||
_, c, err := rpmMetadata.FetchMetadata([]rpmmd.RepoConfig{repoCfg}, "platform:f31")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to fetch checksum: %v", err)
|
||||
}
|
||||
if c["repo"] == "" {
|
||||
t.Errorf("The checksum is empty")
|
||||
}
|
||||
assert.Nilf(t, err, "Failed to fetch checksum: %v", err)
|
||||
assert.NotEqual(t, "", c["repo"], "The checksum is empty")
|
||||
}
|
||||
|
|
|
|||
2
go.mod
2
go.mod
|
|
@ -14,7 +14,7 @@ require (
|
|||
github.com/google/uuid v1.1.1
|
||||
github.com/julienschmidt/httprouter v1.2.0
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/stretchr/testify v1.4.0 // indirect
|
||||
github.com/stretchr/testify v1.4.0
|
||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2 // indirect
|
||||
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4 // indirect
|
||||
)
|
||||
|
|
|
|||
8
vendor/modules.txt
vendored
8
vendor/modules.txt
vendored
|
|
@ -50,6 +50,8 @@ github.com/aws/aws-sdk-go/service/sts/stsiface
|
|||
github.com/coreos/go-semver/semver
|
||||
# github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f
|
||||
github.com/coreos/go-systemd/activation
|
||||
# github.com/davecgh/go-spew v1.1.0
|
||||
github.com/davecgh/go-spew/spew
|
||||
# github.com/gobwas/glob v0.2.3
|
||||
github.com/gobwas/glob
|
||||
github.com/gobwas/glob/compiler
|
||||
|
|
@ -74,6 +76,10 @@ github.com/jmespath/go-jmespath
|
|||
github.com/julienschmidt/httprouter
|
||||
# github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149
|
||||
github.com/mattn/go-ieproxy
|
||||
# github.com/pmezard/go-difflib v1.0.0
|
||||
github.com/pmezard/go-difflib/difflib
|
||||
# github.com/stretchr/testify v1.4.0
|
||||
github.com/stretchr/testify/assert
|
||||
# golang.org/x/net v0.0.0-20200202094626-16171245cfb2
|
||||
golang.org/x/net/http/httpproxy
|
||||
golang.org/x/net/idna
|
||||
|
|
@ -85,3 +91,5 @@ golang.org/x/text/secure/bidirule
|
|||
golang.org/x/text/transform
|
||||
golang.org/x/text/unicode/bidi
|
||||
golang.org/x/text/unicode/norm
|
||||
# gopkg.in/yaml.v2 v2.2.2
|
||||
gopkg.in/yaml.v2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue