зеркало из https://github.com/mozilla/mig.git
Fixing some errors raised by tests
This commit is contained in:
Родитель
ff6d7d82fa
Коммит
3f68ed39e7
|
@ -12,6 +12,7 @@ import (
|
|||
"fmt"
|
||||
"github.com/mozilla/mig"
|
||||
"github.com/mozilla/mig/service"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
|
|
@ -52,12 +52,11 @@ REDHAT_SUPPORT_PRODUCT_VERSION="7"`,
|
|||
|
||||
reader := strings.NewReader(testCase.FileContents)
|
||||
ident, err := getOSRelease(reader)
|
||||
defer reader.Close()
|
||||
|
||||
gotErr := err != nil
|
||||
if testCase.ExpectError && !gotErr {
|
||||
t.Errorf("Expected to get an error but did not")
|
||||
} else if !testCase.ExpectedIdent && gotErr {
|
||||
} else if !testCase.ExpectError && gotErr {
|
||||
t.Errorf("Did not expect to get an error, but got %s", err.Error())
|
||||
} else if ident != testCase.ExpectedIdent {
|
||||
t.Errorf("Expected to get ident \"%s\" but got \"%s\"", testCase.ExpectedIdent, ident)
|
||||
|
|
|
@ -37,7 +37,7 @@ func TestPrompt(t *testing.T) {
|
|||
Desc: "Type 'foo' for testing",
|
||||
Error: "seriously, or I'll be an error.",
|
||||
Prompt: "foo",
|
||||
CacheKey: fmt.Sprintf("gpgagent_test-cachekey-%d", time.Now()),
|
||||
CacheKey: fmt.Sprintf("gpgagent_test-cachekey-%d", time.Now().Unix()),
|
||||
}
|
||||
s1, err := conn.GetPassphrase(req)
|
||||
if err != nil {
|
||||
|
@ -73,7 +73,7 @@ func TestPrompt(t *testing.T) {
|
|||
Desc: "Press Cancel for testing",
|
||||
Error: "seriously, or I'll be an error.",
|
||||
Prompt: "cancel!",
|
||||
CacheKey: fmt.Sprintf("gpgagent_test-cachekey-%d", time.Now()),
|
||||
CacheKey: fmt.Sprintf("gpgagent_test-cachekey-%d", time.Now().Unix()),
|
||||
})
|
||||
if err != ErrCancel {
|
||||
t.Errorf("expected cancel, got %q, %v", s4, err)
|
||||
|
|
Загрузка…
Ссылка в новой задаче