From 2b538bd555b001e69346321485cd07a5c5c11d67 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Thu, 28 Aug 2014 00:28:54 +0000 Subject: [PATCH] remove auth_test.go Signed-off-by: Victor Vieux --- integration/auth_test.go | 75 ---------------------------------------- 1 file changed, 75 deletions(-) delete mode 100644 integration/auth_test.go diff --git a/integration/auth_test.go b/integration/auth_test.go deleted file mode 100644 index 42cd1ac64d..0000000000 --- a/integration/auth_test.go +++ /dev/null @@ -1,75 +0,0 @@ -package docker - -import ( - "crypto/rand" - "encoding/hex" - "fmt" - "os" - "strings" - "testing" - - "github.com/docker/docker/registry" -) - -// FIXME: these tests have an external dependency on a staging index hosted -// on the docker.io infrastructure. That dependency should be removed. -// - Unit tests should have no side-effect dependencies. -// - Integration tests should have side-effects limited to the host environment being tested. - -func TestLogin(t *testing.T) { - t.Skip("FIXME: please remove dependency on external services") - os.Setenv("DOCKER_INDEX_URL", "https://registry-stage.hub.docker.com/v1/") - defer os.Setenv("DOCKER_INDEX_URL", "") - authConfig := ®istry.AuthConfig{ - Username: "unittester", - Password: "surlautrerivejetattendrai", - Email: "noise+unittester@docker.com", - ServerAddress: "https://registry-stage.hub.docker.com/v1/", - } - status, err := registry.Login(authConfig, nil) - if err != nil { - t.Fatal(err) - } - if status != "Login Succeeded" { - t.Fatalf("Expected status \"Login Succeeded\", found \"%s\" instead", status) - } -} - -func TestCreateAccount(t *testing.T) { - t.Skip("FIXME: please remove dependency on external services") - tokenBuffer := make([]byte, 16) - _, err := rand.Read(tokenBuffer) - if err != nil { - t.Fatal(err) - } - token := hex.EncodeToString(tokenBuffer)[:12] - username := "ut" + token - authConfig := ®istry.AuthConfig{ - Username: username, - Password: "test42", - Email: fmt.Sprintf("docker-ut+%s@example.com", token), - ServerAddress: "https://registry-stage.hub.docker.com/v1/", - } - status, err := registry.Login(authConfig, nil) - if err != nil { - t.Fatal(err) - } - expectedStatus := fmt.Sprintf( - "Account created. Please see the documentation of the registry %s for instructions how to activate it.", - authConfig.ServerAddress, - ) - if status != expectedStatus { - t.Fatalf("Expected status: \"%s\", found \"%s\" instead.", expectedStatus, status) - } - - status, err = registry.Login(authConfig, nil) - if err == nil { - t.Fatalf("Expected error but found nil instead") - } - - expectedError := "Login: Account is not Active" - - if !strings.Contains(err.Error(), expectedError) { - t.Fatalf("Expected message \"%s\" but found \"%s\" instead", expectedError, err) - } -}