Update tests to reflect new AuthConfig

Upstream-commit: 10e19e4b97dba71b603d652d5a046ef792d9d704
Component: engine
This commit is contained in:
Guillaume J. Charmes
2013-05-15 17:31:11 -07:00
parent 2d208e56c7
commit 4f2b2696d3
4 changed files with 11 additions and 7 deletions
+2 -2
View File
@@ -67,9 +67,9 @@ func postAuth(srv *Server, w http.ResponseWriter, r *http.Request, vars map[stri
status, err := auth.Login(newAuthConfig)
if err != nil {
return err
} else {
srv.registry.ResetClient(newAuthConfig)
}
srv.registry.ResetClient(newAuthConfig)
if status != "" {
b, err := json.Marshal(&ApiAuth{Status: status})
if err != nil {
+7 -3
View File
@@ -51,6 +51,7 @@ func TestGetAuth(t *testing.T) {
if err := postAuth(srv, r, req, nil); err != nil {
t.Fatal(err)
}
if r.Code != http.StatusOK && r.Code != 0 {
t.Fatalf("%d OK or 0 expected, received %d\n", http.StatusOK, r.Code)
}
@@ -229,7 +230,7 @@ func TestGetImagesSearch(t *testing.T) {
srv := &Server{
runtime: runtime,
registry: registry.NewRegistry(runtime.authConfig),
registry: registry.NewRegistry(runtime.root),
}
r := httptest.NewRecorder()
@@ -484,13 +485,16 @@ func TestPostAuth(t *testing.T) {
}
defer nuke(runtime)
srv := &Server{runtime: runtime}
srv := &Server{
runtime: runtime,
registry: registry.NewRegistry(runtime.root),
}
authConfigOrig := &auth.AuthConfig{
Username: "utest",
Email: "utest@yopmail.com",
}
runtime.authConfig = authConfigOrig
srv.registry.ResetClient(authConfigOrig)
r := httptest.NewRecorder()
if err := getAuth(srv, r, nil, nil); err != nil {
+1 -1
View File
@@ -432,7 +432,7 @@ func (r *Registry) ResetClient(authConfig *auth.AuthConfig) {
func (r *Registry) GetAuthConfig() *auth.AuthConfig {
return &auth.AuthConfig{
Username: r.authConfig.Username,
Email: r.authConfig.Password,
Email: r.authConfig.Email,
}
}
+1 -1
View File
@@ -72,7 +72,7 @@ func init() {
// Create the "Server"
srv := &Server{
runtime: runtime,
registry: registry.NewRegistry(runtime.authConfig),
registry: registry.NewRegistry(runtime.root),
}
// Retrieve the Image
if err := srv.ImagePull(unitTestImageName, "", "", os.Stdout); err != nil {