diff options
author | Miloslav Trmač <mitr@redhat.com> | 2021-09-11 20:26:28 +0200 |
---|---|---|
committer | Miloslav Trmač <mitr@redhat.com> | 2021-12-10 18:09:55 +0100 |
commit | 5a5aa6009fdfde0524bc4e551742c366ad0164df (patch) | |
tree | d5f04f9515a8e8d920b5aa0beb1616556582bf62 /pkg/auth | |
parent | ff003928b2360304f6b9458d324df090917fab02 (diff) | |
download | podman-5a5aa6009fdfde0524bc4e551742c366ad0164df.tar.gz podman-5a5aa6009fdfde0524bc4e551742c366ad0164df.tar.bz2 podman-5a5aa6009fdfde0524bc4e551742c366ad0164df.zip |
Improve TestAuthConfigsToAuthFile
Remove the created temporary file.
Use more appropriate assertion calls.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Diffstat (limited to 'pkg/auth')
-rw-r--r-- | pkg/auth/auth_test.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pkg/auth/auth_test.go b/pkg/auth/auth_test.go index a0b97b106..38f82ee04 100644 --- a/pkg/auth/auth_test.go +++ b/pkg/auth/auth_test.go @@ -4,6 +4,7 @@ import ( "encoding/base64" "io/ioutil" "net/http" + "os" "testing" "github.com/containers/image/v5/types" @@ -57,13 +58,14 @@ func TestAuthConfigsToAuthFile(t *testing.T) { filePath, err := authConfigsToAuthFile(configs) if tc.shouldErr { - assert.NotNil(t, err) + assert.Error(t, err) assert.Empty(t, filePath) } else { - assert.Nil(t, err) + assert.NoError(t, err) content, err := ioutil.ReadFile(filePath) - assert.Nil(t, err) + require.NoError(t, err) assert.Contains(t, string(content), tc.expectedContains) + os.Remove(filePath) } } } |