mirror of https://github.com/containers/podman.git
Improve TestAuthConfigsToAuthFile
Remove the created temporary file. Use more appropriate assertion calls. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
parent
ff003928b2
commit
5a5aa6009f
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue