This commit is contained in:
Yasuhiro Matsumoto 2017-04-14 20:05:18 +09:00
parent 47ae1f78c2
commit d57df64d26
2 changed files with 37 additions and 3 deletions

View file

@ -108,3 +108,22 @@ func TestGetConfig(t *testing.T) {
t.Fatalf("want %q but %q", "foo", got)
}
}
func TestPrompt(t *testing.T) {
readUsername = func() (string, error) {
return "foo", nil
}
readPassword = func() (string, error) {
return "bar", nil
}
username, password, err := prompt()
if err != nil {
t.Fatal(err)
}
if username != "foo" {
t.Fatalf("want %q but %q", "foo", username)
}
if password != "bar" {
t.Fatalf("want %q but %q", "bar", password)
}
}