Sew up failing tests
parent
65ae474a5c
commit
b731481fdc
|
@ -51,8 +51,8 @@ func TestService_Me(t *testing.T) {
|
||||||
OrganizationsStore: &mocks.OrganizationsStore{
|
OrganizationsStore: &mocks.OrganizationsStore{
|
||||||
DefaultOrganizationF: func(ctx context.Context) (*chronograf.Organization, error) {
|
DefaultOrganizationF: func(ctx context.Context) (*chronograf.Organization, error) {
|
||||||
return &chronograf.Organization{
|
return &chronograf.Organization{
|
||||||
ID: 0,
|
ID: 0,
|
||||||
Name: "Default",
|
Name: "Default",
|
||||||
Public: true,
|
Public: true,
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
|
@ -60,14 +60,14 @@ func TestService_Me(t *testing.T) {
|
||||||
switch *q.ID {
|
switch *q.ID {
|
||||||
case 0:
|
case 0:
|
||||||
return &chronograf.Organization{
|
return &chronograf.Organization{
|
||||||
ID: 0,
|
ID: 0,
|
||||||
Name: "Default",
|
Name: "Default",
|
||||||
Public: true,
|
Public: true,
|
||||||
}, nil
|
}, nil
|
||||||
case 1:
|
case 1:
|
||||||
return &chronograf.Organization{
|
return &chronograf.Organization{
|
||||||
ID: 1,
|
ID: 1,
|
||||||
Name: "The Bad Place",
|
Name: "The Bad Place",
|
||||||
Public: true,
|
Public: true,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ func TestService_Me(t *testing.T) {
|
||||||
},
|
},
|
||||||
wantStatus: http.StatusOK,
|
wantStatus: http.StatusOK,
|
||||||
wantContentType: "application/json",
|
wantContentType: "application/json",
|
||||||
wantBody: `{"name":"secret","roles":[{"name":"member","organization":"0"}],"provider":"auth0","scheme":"oauth2","links":{"self":"/chronograf/v1/users/0"},"organizations":[{"id":"0","name":"The Bad Place"}],"currentOrganization":{"id":"0","name":"The Bad Place"}}
|
wantBody: `{"name":"secret","roles":[{"name":"member","organization":"0"}],"provider":"auth0","scheme":"oauth2","links":{"self":"/chronograf/v1/users/0"},"organizations":[{"id":"0","name":"The Bad Place","public":false}],"currentOrganization":{"id":"0","name":"The Bad Place","public":false}}
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -166,13 +166,15 @@ func TestService_Me(t *testing.T) {
|
||||||
OrganizationsStore: &mocks.OrganizationsStore{
|
OrganizationsStore: &mocks.OrganizationsStore{
|
||||||
DefaultOrganizationF: func(ctx context.Context) (*chronograf.Organization, error) {
|
DefaultOrganizationF: func(ctx context.Context) (*chronograf.Organization, error) {
|
||||||
return &chronograf.Organization{
|
return &chronograf.Organization{
|
||||||
ID: 0,
|
ID: 0,
|
||||||
|
Public: true,
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) {
|
GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) {
|
||||||
return &chronograf.Organization{
|
return &chronograf.Organization{
|
||||||
ID: 0,
|
ID: 0,
|
||||||
Name: "The Bad Place",
|
Name: "The Bad Place",
|
||||||
|
Public: true,
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -408,7 +410,7 @@ func TestService_UpdateMe(t *testing.T) {
|
||||||
},
|
},
|
||||||
wantStatus: http.StatusOK,
|
wantStatus: http.StatusOK,
|
||||||
wantContentType: "application/json",
|
wantContentType: "application/json",
|
||||||
wantBody: `{"name":"me","roles":[{"name":"admin","organization":"1337"},{"name":"member","organization":"0"}],"provider":"github","scheme":"oauth2","links":{"self":"/chronograf/v1/users/0"},"organizations":[{"id":"0","name":"Default","public":true},{"id":"1337","name":"The ShillBillThrilliettas"}],"currentOrganization":{"id":"1337","name":"The ShillBillThrilliettas","public":true}}`,
|
wantBody: `{"name":"me","roles":[{"name":"admin","organization":"1337"},{"name":"member","organization":"0"}],"provider":"github","scheme":"oauth2","links":{"self":"/chronograf/v1/users/0"},"organizations":[{"id":"0","name":"Default","public":true},{"id":"1337","name":"The ShillBillThrilliettas","public":true}],"currentOrganization":{"id":"1337","name":"The ShillBillThrilliettas","public":true}}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Change the current User's organization",
|
name: "Change the current User's organization",
|
||||||
|
@ -464,8 +466,8 @@ func TestService_UpdateMe(t *testing.T) {
|
||||||
}, nil
|
}, nil
|
||||||
case 0:
|
case 0:
|
||||||
return &chronograf.Organization{
|
return &chronograf.Organization{
|
||||||
ID: 0,
|
ID: 0,
|
||||||
Name: "Default",
|
Name: "Default",
|
||||||
Public: true,
|
Public: true,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -480,7 +482,7 @@ func TestService_UpdateMe(t *testing.T) {
|
||||||
},
|
},
|
||||||
wantStatus: http.StatusOK,
|
wantStatus: http.StatusOK,
|
||||||
wantContentType: "application/json",
|
wantContentType: "application/json",
|
||||||
wantBody: `{"name":"me","roles":[{"name":"admin","organization":"1337"},{"name":"member","organization":"0"}],"provider":"github","scheme":"oauth2","links":{"self":"/chronograf/v1/users/0"},"organizations":[{"id":"0","name":"Default","public":true},{"id":"1337","name":"The ThrillShilliettos"}],"currentOrganization":{"id":"1337","name":"The ThrillShilliettos","public":true}}`,
|
wantBody: `{"name":"me","roles":[{"name":"admin","organization":"1337"},{"name":"member","organization":"0"}],"provider":"github","scheme":"oauth2","links":{"self":"/chronograf/v1/users/0"},"organizations":[{"id":"0","name":"Default","public":true},{"id":"1337","name":"The ThrillShilliettos","public":false}],"currentOrganization":{"id":"1337","name":"The ThrillShilliettos","public":false}}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Unable to find requested user in valid organization",
|
name: "Unable to find requested user in valid organization",
|
||||||
|
@ -527,9 +529,9 @@ func TestService_UpdateMe(t *testing.T) {
|
||||||
return nil, fmt.Errorf("Invalid organization query: missing ID")
|
return nil, fmt.Errorf("Invalid organization query: missing ID")
|
||||||
}
|
}
|
||||||
return &chronograf.Organization{
|
return &chronograf.Organization{
|
||||||
ID: 1337,
|
ID: 1337,
|
||||||
Name: "The ShillBillThrilliettas",
|
Name: "The ShillBillThrilliettas",
|
||||||
Public: true
|
Public: true,
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -64,7 +64,7 @@ func TestService_OrganizationID(t *testing.T) {
|
||||||
id: "1337",
|
id: "1337",
|
||||||
wantStatus: http.StatusOK,
|
wantStatus: http.StatusOK,
|
||||||
wantContentType: "application/json",
|
wantContentType: "application/json",
|
||||||
wantBody: `{"id":"1337","name":"The Good Place","links":{"self":"/chronograf/v1/organizations/1337"}}`,
|
wantBody: `{"links":{"self":"/chronograf/v1/organizations/1337"},"id":"1337","name":"The Good Place","public":false}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ func TestService_Organizations(t *testing.T) {
|
||||||
},
|
},
|
||||||
wantStatus: http.StatusOK,
|
wantStatus: http.StatusOK,
|
||||||
wantContentType: "application/json",
|
wantContentType: "application/json",
|
||||||
wantBody: `{"organizations":[{"id":"1337","name":"The Good Place","links":{"self":"/chronograf/v1/organizations/1337"}},{"id":"100","name":"The Bad Place","links":{"self":"/chronograf/v1/organizations/100"}}],"links":{"self":"/chronograf/v1/organizations"}}`,
|
wantBody: `{"links":{"self":"/chronograf/v1/organizations"},"organizations":[{"links":{"self":"/chronograf/v1/organizations/1337"},"id":"1337","name":"The Good Place","public":false},{"links":{"self":"/chronograf/v1/organizations/100"},"id":"100","name":"The Bad Place","public":false}]}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ func TestService_UpdateOrganization(t *testing.T) {
|
||||||
id: "1337",
|
id: "1337",
|
||||||
wantStatus: http.StatusOK,
|
wantStatus: http.StatusOK,
|
||||||
wantContentType: "application/json",
|
wantContentType: "application/json",
|
||||||
wantBody: `{"id":"1337","name":"The Bad Place","defaultRole":"viewer","links":{"self":"/chronograf/v1/organizations/1337"}}`,
|
wantBody: `{"id":"1337","name":"The Bad Place","defaultRole":"viewer","links":{"self":"/chronograf/v1/organizations/1337"},"public":false}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Update Organization public",
|
name: "Update Organization public",
|
||||||
|
@ -332,7 +332,7 @@ func TestService_UpdateOrganization(t *testing.T) {
|
||||||
id: "1337",
|
id: "1337",
|
||||||
wantStatus: http.StatusOK,
|
wantStatus: http.StatusOK,
|
||||||
wantContentType: "application/json",
|
wantContentType: "application/json",
|
||||||
wantBody: `{"id":"1337","name":"The Good Place","defaultRole":"viewer","links":{"self":"/chronograf/v1/organizations/1337"}}`,
|
wantBody: `{"links":{"self":"/chronograf/v1/organizations/1337"},"id":"1337","name":"The Good Place","defaultRole":"viewer","public":false}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Update Organization - invalid update",
|
name: "Update Organization - invalid update",
|
||||||
|
|
Loading…
Reference in New Issue