Merge pull request #909 from dotcloud/fix_auth_tests

Fix the auth tests
This commit is contained in:
Guillaume J. Charmes 2013-06-20 10:14:55 -07:00
commit 8807b7dd46

View file

@ -10,8 +10,8 @@ import (
func TestEncodeAuth(t *testing.T) {
newAuthConfig := &AuthConfig{Username: "ken", Password: "test", Email: "test@example.com"}
authStr := EncodeAuth(newAuthConfig)
decAuthConfig, err := DecodeAuth(authStr)
authStr := encodeAuth(newAuthConfig)
decAuthConfig, err := decodeAuth(authStr)
if err != nil {
t.Fatal(err)
}
@ -30,7 +30,7 @@ func TestLogin(t *testing.T) {
os.Setenv("DOCKER_INDEX_URL", "https://indexstaging-docker.dotcloud.com")
defer os.Setenv("DOCKER_INDEX_URL", "")
authConfig := NewAuthConfig("unittester", "surlautrerivejetattendrai", "noise+unittester@dotcloud.com", "/tmp")
status, err := Login(authConfig)
status, err := Login(authConfig, false)
if err != nil {
t.Fatal(err)
}
@ -50,7 +50,7 @@ func TestCreateAccount(t *testing.T) {
token := hex.EncodeToString(tokenBuffer)[:12]
username := "ut" + token
authConfig := NewAuthConfig(username, "test42", "docker-ut+"+token+"@example.com", "/tmp")
status, err := Login(authConfig)
status, err := Login(authConfig, false)
if err != nil {
t.Fatal(err)
}
@ -60,7 +60,7 @@ func TestCreateAccount(t *testing.T) {
t.Fatalf("Expected status: \"%s\", found \"%s\" instead.", expectedStatus, status)
}
status, err = Login(authConfig)
status, err = Login(authConfig, false)
if err == nil {
t.Fatalf("Expected error but found nil instead")
}