mirror of
https://github.com/clearlinux/docker.git
synced 2026-10-03 23:38:24 +00:00
Merge auth package within registry
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume@charmes.net> (github: creack)
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"github.com/dotcloud/docker/auth"
|
||||
"github.com/dotcloud/docker/registry"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -18,13 +18,13 @@ import (
|
||||
func TestLogin(t *testing.T) {
|
||||
os.Setenv("DOCKER_INDEX_URL", "https://indexstaging-docker.dotcloud.com")
|
||||
defer os.Setenv("DOCKER_INDEX_URL", "")
|
||||
authConfig := &auth.AuthConfig{
|
||||
authConfig := ®istry.AuthConfig{
|
||||
Username: "unittester",
|
||||
Password: "surlautrerivejetattendrai",
|
||||
Email: "noise+unittester@docker.com",
|
||||
ServerAddress: "https://indexstaging-docker.dotcloud.com/v1/",
|
||||
}
|
||||
status, err := auth.Login(authConfig, nil)
|
||||
status, err := registry.Login(authConfig, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -41,13 +41,13 @@ func TestCreateAccount(t *testing.T) {
|
||||
}
|
||||
token := hex.EncodeToString(tokenBuffer)[:12]
|
||||
username := "ut" + token
|
||||
authConfig := &auth.AuthConfig{
|
||||
authConfig := ®istry.AuthConfig{
|
||||
Username: username,
|
||||
Password: "test42",
|
||||
Email: fmt.Sprintf("docker-ut+%s@example.com", token),
|
||||
ServerAddress: "https://indexstaging-docker.dotcloud.com/v1/",
|
||||
}
|
||||
status, err := auth.Login(authConfig, nil)
|
||||
status, err := registry.Login(authConfig, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -59,7 +59,7 @@ func TestCreateAccount(t *testing.T) {
|
||||
t.Fatalf("Expected status: \"%s\", found \"%s\" instead.", expectedStatus, status)
|
||||
}
|
||||
|
||||
status, err = auth.Login(authConfig, nil)
|
||||
status, err = registry.Login(authConfig, nil)
|
||||
if err == nil {
|
||||
t.Fatalf("Expected error but found nil instead")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user