| ... | ... |
@@ -179,7 +179,7 @@ func getInfo(srv *Server, version float64, w http.ResponseWriter, r *http.Reques |
| 179 | 179 |
} |
| 180 | 180 |
|
| 181 | 181 |
func getEvents(srv *Server, version float64, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
| 182 |
- sendEvent := func(wf *utils.WriteFlusher, event *utils.JSONMessage) (error) {
|
|
| 182 |
+ sendEvent := func(wf *utils.WriteFlusher, event *utils.JSONMessage) error {
|
|
| 183 | 183 |
b, err := json.Marshal(event) |
| 184 | 184 |
if err != nil {
|
| 185 | 185 |
return fmt.Errorf("JSON error")
|
| ... | ... |
@@ -11,7 +11,9 @@ import ( |
| 11 | 11 |
func TestEncodeAuth(t *testing.T) {
|
| 12 | 12 |
newAuthConfig := &AuthConfig{Username: "ken", Password: "test", Email: "test@example.com"}
|
| 13 | 13 |
authStr := encodeAuth(newAuthConfig) |
| 14 |
- decAuthConfig, err := decodeAuth(authStr) |
|
| 14 |
+ decAuthConfig := &AuthConfig{}
|
|
| 15 |
+ var err error |
|
| 16 |
+ decAuthConfig.Username, decAuthConfig.Password, err = decodeAuth(authStr) |
|
| 15 | 17 |
if err != nil {
|
| 16 | 18 |
t.Fatal(err) |
| 17 | 19 |
} |
| ... | ... |
@@ -29,8 +31,8 @@ func TestEncodeAuth(t *testing.T) {
|
| 29 | 29 |
func TestLogin(t *testing.T) {
|
| 30 | 30 |
os.Setenv("DOCKER_INDEX_URL", "https://indexstaging-docker.dotcloud.com")
|
| 31 | 31 |
defer os.Setenv("DOCKER_INDEX_URL", "")
|
| 32 |
- authConfig := NewAuthConfig("unittester", "surlautrerivejetattendrai", "noise+unittester@dotcloud.com", "/tmp")
|
|
| 33 |
- status, err := Login(authConfig, false) |
|
| 32 |
+ authConfig := &AuthConfig{Username: "unittester", Password: "surlautrerivejetattendrai", Email: "noise+unittester@dotcloud.com"}
|
|
| 33 |
+ status, err := Login(authConfig) |
|
| 34 | 34 |
if err != nil {
|
| 35 | 35 |
t.Fatal(err) |
| 36 | 36 |
} |
| ... | ... |
@@ -49,8 +51,8 @@ func TestCreateAccount(t *testing.T) {
|
| 49 | 49 |
} |
| 50 | 50 |
token := hex.EncodeToString(tokenBuffer)[:12] |
| 51 | 51 |
username := "ut" + token |
| 52 |
- authConfig := NewAuthConfig(username, "test42", "docker-ut+"+token+"@example.com", "/tmp") |
|
| 53 |
- status, err := Login(authConfig, false) |
|
| 52 |
+ authConfig := &AuthConfig{Username: username, Password: "test42", Email: "docker-ut+"+token+"@example.com"}
|
|
| 53 |
+ status, err := Login(authConfig) |
|
| 54 | 54 |
if err != nil {
|
| 55 | 55 |
t.Fatal(err) |
| 56 | 56 |
} |
| ... | ... |
@@ -60,7 +62,7 @@ func TestCreateAccount(t *testing.T) {
|
| 60 | 60 |
t.Fatalf("Expected status: \"%s\", found \"%s\" instead.", expectedStatus, status)
|
| 61 | 61 |
} |
| 62 | 62 |
|
| 63 |
- status, err = Login(authConfig, false) |
|
| 63 |
+ status, err = Login(authConfig) |
|
| 64 | 64 |
if err == nil {
|
| 65 | 65 |
t.Fatalf("Expected error but found nil instead")
|
| 66 | 66 |
} |