Clear test noise
parent
9eccded4b2
commit
1aebbf2bd4
|
@ -187,6 +187,7 @@ func TestOrganizationsStore_All(t *testing.T) {
|
||||||
{
|
{
|
||||||
Name: bolt.DefaultOrganizationName,
|
Name: bolt.DefaultOrganizationName,
|
||||||
DefaultRole: bolt.DefaultOrganizationRole,
|
DefaultRole: bolt.DefaultOrganizationRole,
|
||||||
|
Public: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "EE - Evil Empire",
|
Name: "EE - Evil Empire",
|
||||||
|
@ -620,6 +621,7 @@ func TestOrganizationsStore_DefaultOrganization(t *testing.T) {
|
||||||
ID: bolt.DefaultOrganizationID,
|
ID: bolt.DefaultOrganizationID,
|
||||||
Name: bolt.DefaultOrganizationName,
|
Name: bolt.DefaultOrganizationName,
|
||||||
DefaultRole: bolt.DefaultOrganizationRole,
|
DefaultRole: bolt.DefaultOrganizationRole,
|
||||||
|
Public: true,
|
||||||
},
|
},
|
||||||
wantErr: false,
|
wantErr: false,
|
||||||
},
|
},
|
||||||
|
|
|
@ -53,6 +53,7 @@ func TestService_Me(t *testing.T) {
|
||||||
return &chronograf.Organization{
|
return &chronograf.Organization{
|
||||||
ID: 0,
|
ID: 0,
|
||||||
Name: "Default",
|
Name: "Default",
|
||||||
|
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) {
|
||||||
|
@ -61,11 +62,13 @@ func TestService_Me(t *testing.T) {
|
||||||
return &chronograf.Organization{
|
return &chronograf.Organization{
|
||||||
ID: 0,
|
ID: 0,
|
||||||
Name: "Default",
|
Name: "Default",
|
||||||
|
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,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
@ -97,7 +100,7 @@ func TestService_Me(t *testing.T) {
|
||||||
},
|
},
|
||||||
wantStatus: http.StatusOK,
|
wantStatus: http.StatusOK,
|
||||||
wantContentType: "application/json",
|
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{
|
return &chronograf.Organization{
|
||||||
ID: 0,
|
ID: 0,
|
||||||
DefaultRole: roles.MemberRoleName,
|
DefaultRole: roles.MemberRoleName,
|
||||||
|
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) {
|
||||||
|
@ -371,8 +375,9 @@ func TestService_UpdateMe(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,
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) {
|
GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) {
|
||||||
|
@ -382,13 +387,15 @@ func TestService_UpdateMe(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,
|
||||||
}, nil
|
}, nil
|
||||||
case 1337:
|
case 1337:
|
||||||
return &chronograf.Organization{
|
return &chronograf.Organization{
|
||||||
ID: 1337,
|
ID: 1337,
|
||||||
Name: "The ShillBillThrilliettas",
|
Name: "The ShillBillThrilliettas",
|
||||||
|
Public: true,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
@ -401,7 +408,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"},{"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",
|
name: "Change the current User's organization",
|
||||||
|
@ -440,8 +447,9 @@ func TestService_UpdateMe(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,
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) {
|
GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) {
|
||||||
|
@ -458,6 +466,7 @@ func TestService_UpdateMe(t *testing.T) {
|
||||||
return &chronograf.Organization{
|
return &chronograf.Organization{
|
||||||
ID: 0,
|
ID: 0,
|
||||||
Name: "Default",
|
Name: "Default",
|
||||||
|
Public: true,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
@ -471,7 +480,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"},{"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",
|
name: "Unable to find requested user in valid organization",
|
||||||
|
@ -520,6 +529,7 @@ func TestService_UpdateMe(t *testing.T) {
|
||||||
return &chronograf.Organization{
|
return &chronograf.Organization{
|
||||||
ID: 1337,
|
ID: 1337,
|
||||||
Name: "The ShillBillThrilliettas",
|
Name: "The ShillBillThrilliettas",
|
||||||
|
Public: true
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue