mirror of https://github.com/docker/docs.git
Merge pull request #909 from dotcloud/fix_auth_tests
Fix the auth tests
This commit is contained in:
commit
8807b7dd46
|
@ -10,8 +10,8 @@ import (
|
||||||
|
|
||||||
func TestEncodeAuth(t *testing.T) {
|
func TestEncodeAuth(t *testing.T) {
|
||||||
newAuthConfig := &AuthConfig{Username: "ken", Password: "test", Email: "test@example.com"}
|
newAuthConfig := &AuthConfig{Username: "ken", Password: "test", Email: "test@example.com"}
|
||||||
authStr := EncodeAuth(newAuthConfig)
|
authStr := encodeAuth(newAuthConfig)
|
||||||
decAuthConfig, err := DecodeAuth(authStr)
|
decAuthConfig, err := decodeAuth(authStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ func TestLogin(t *testing.T) {
|
||||||
os.Setenv("DOCKER_INDEX_URL", "https://indexstaging-docker.dotcloud.com")
|
os.Setenv("DOCKER_INDEX_URL", "https://indexstaging-docker.dotcloud.com")
|
||||||
defer os.Setenv("DOCKER_INDEX_URL", "")
|
defer os.Setenv("DOCKER_INDEX_URL", "")
|
||||||
authConfig := NewAuthConfig("unittester", "surlautrerivejetattendrai", "noise+unittester@dotcloud.com", "/tmp")
|
authConfig := NewAuthConfig("unittester", "surlautrerivejetattendrai", "noise+unittester@dotcloud.com", "/tmp")
|
||||||
status, err := Login(authConfig)
|
status, err := Login(authConfig, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ func TestCreateAccount(t *testing.T) {
|
||||||
token := hex.EncodeToString(tokenBuffer)[:12]
|
token := hex.EncodeToString(tokenBuffer)[:12]
|
||||||
username := "ut" + token
|
username := "ut" + token
|
||||||
authConfig := NewAuthConfig(username, "test42", "docker-ut+"+token+"@example.com", "/tmp")
|
authConfig := NewAuthConfig(username, "test42", "docker-ut+"+token+"@example.com", "/tmp")
|
||||||
status, err := Login(authConfig)
|
status, err := Login(authConfig, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ func TestCreateAccount(t *testing.T) {
|
||||||
t.Fatalf("Expected status: \"%s\", found \"%s\" instead.", expectedStatus, status)
|
t.Fatalf("Expected status: \"%s\", found \"%s\" instead.", expectedStatus, status)
|
||||||
}
|
}
|
||||||
|
|
||||||
status, err = Login(authConfig)
|
status, err = Login(authConfig, false)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("Expected error but found nil instead")
|
t.Fatalf("Expected error but found nil instead")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue