Clear test noise

pull/10616/head
Luke Morris 2017-11-10 18:45:25 -08:00
parent 9eccded4b2
commit 1aebbf2bd4
2 changed files with 23 additions and 11 deletions

View File

@ -187,6 +187,7 @@ func TestOrganizationsStore_All(t *testing.T) {
{
Name: bolt.DefaultOrganizationName,
DefaultRole: bolt.DefaultOrganizationRole,
Public: true,
},
{
Name: "EE - Evil Empire",
@ -620,6 +621,7 @@ func TestOrganizationsStore_DefaultOrganization(t *testing.T) {
ID: bolt.DefaultOrganizationID,
Name: bolt.DefaultOrganizationName,
DefaultRole: bolt.DefaultOrganizationRole,
Public: true,
},
wantErr: false,
},

View File

@ -53,6 +53,7 @@ func TestService_Me(t *testing.T) {
return &chronograf.Organization{
ID: 0,
Name: "Default",
Public: true,
}, nil
},
GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) {
@ -61,11 +62,13 @@ func TestService_Me(t *testing.T) {
return &chronograf.Organization{
ID: 0,
Name: "Default",
Public: true,
}, nil
case 1:
return &chronograf.Organization{
ID: 1,
Name: "The Bad Place",
Public: true,
}, nil
}
return nil, nil
@ -97,7 +100,7 @@ func TestService_Me(t *testing.T) {
},
wantStatus: http.StatusOK,
wantContentType: "application/json",
wantBody: `{"name":"me","roles":[{"name":"member","organization":"0"}],"provider":"github","scheme":"oauth2","links":{"self":"/chronograf/v1/users/0"},"organizations":[{"id":"0","name":"Default"}],"currentOrganization":{"id":"0","name":"Default"}}
wantBody: `{"name":"me","roles":[{"name":"member","organization":"0"}],"provider":"github","scheme":"oauth2","links":{"self":"/chronograf/v1/users/0"},"organizations":[{"id":"0","name":"Default","public":true}],"currentOrganization":{"id":"0","name":"Default","public":true}}
`,
},
{
@ -114,6 +117,7 @@ func TestService_Me(t *testing.T) {
return &chronograf.Organization{
ID: 0,
DefaultRole: roles.MemberRoleName,
Public: true,
}, nil
},
GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) {
@ -373,6 +377,7 @@ func TestService_UpdateMe(t *testing.T) {
return &chronograf.Organization{
ID: 0,
Name: "Default",
Public: true,
}, nil
},
GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) {
@ -384,11 +389,13 @@ func TestService_UpdateMe(t *testing.T) {
return &chronograf.Organization{
ID: 0,
Name: "Default",
Public: true,
}, nil
case 1337:
return &chronograf.Organization{
ID: 1337,
Name: "The ShillBillThrilliettas",
Public: true,
}, nil
}
return nil, nil
@ -401,7 +408,7 @@ func TestService_UpdateMe(t *testing.T) {
},
wantStatus: http.StatusOK,
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"},{"id":"1337","name":"The ShillBillThrilliettas"}],"currentOrganization":{"id":"1337","name":"The ShillBillThrilliettas"}}`,
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}}`,
},
{
name: "Change the current User's organization",
@ -442,6 +449,7 @@ func TestService_UpdateMe(t *testing.T) {
return &chronograf.Organization{
ID: 0,
Name: "Default",
Public: true,
}, nil
},
GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) {
@ -458,6 +466,7 @@ func TestService_UpdateMe(t *testing.T) {
return &chronograf.Organization{
ID: 0,
Name: "Default",
Public: true,
}, nil
}
return nil, nil
@ -471,7 +480,7 @@ func TestService_UpdateMe(t *testing.T) {
},
wantStatus: http.StatusOK,
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"},{"id":"1337","name":"The ThrillShilliettos"}],"currentOrganization":{"id":"1337","name":"The ThrillShilliettos"}}`,
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}}`,
},
{
name: "Unable to find requested user in valid organization",
@ -520,6 +529,7 @@ func TestService_UpdateMe(t *testing.T) {
return &chronograf.Organization{
ID: 1337,
Name: "The ShillBillThrilliettas",
Public: true
}, nil
},
},