Make Public values explicit

pull/10616/head
Luke Morris 2017-11-13 12:15:53 -08:00
parent 29815774f0
commit 0424f9f92e
3 changed files with 26 additions and 16 deletions

View File

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

View File

@ -122,8 +122,9 @@ func TestService_Me(t *testing.T) {
},
GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) {
return &chronograf.Organization{
ID: 0,
Name: "The Bad Place",
ID: 0,
Name: "The Bad Place",
Public: false,
}, nil
},
},
@ -253,8 +254,9 @@ func TestService_Me(t *testing.T) {
},
GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) {
return &chronograf.Organization{
ID: 0,
Name: "The Bad Place",
ID: 0,
Name: "The Bad Place",
Public: false,
}, nil
},
},
@ -461,8 +463,9 @@ func TestService_UpdateMe(t *testing.T) {
switch *q.ID {
case 1337:
return &chronograf.Organization{
ID: 1337,
Name: "The ThrillShilliettos",
ID: 1337,
Name: "The ThrillShilliettos",
Public: false,
}, nil
case 0:
return &chronograf.Organization{

View File

@ -52,8 +52,9 @@ func TestService_OrganizationID(t *testing.T) {
switch *q.ID {
case 1337:
return &chronograf.Organization{
ID: 1337,
Name: "The Good Place",
ID: 1337,
Name: "The Good Place",
Public: false,
}, nil
default:
return nil, fmt.Errorf("Organization with ID %s not found", *q.ID)
@ -138,12 +139,14 @@ func TestService_Organizations(t *testing.T) {
AllF: func(ctx context.Context) ([]chronograf.Organization, error) {
return []chronograf.Organization{
chronograf.Organization{
ID: 1337,
Name: "The Good Place",
ID: 1337,
Name: "The Good Place",
Public: true,
},
chronograf.Organization{
ID: 100,
Name: "The Bad Place",
ID: 100,
Name: "The Bad Place",
Public: false,
},
}, nil
},
@ -151,7 +154,7 @@ func TestService_Organizations(t *testing.T) {
},
wantStatus: http.StatusOK,
wantContentType: "application/json",
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}]}`,
wantBody: `{"links":{"self":"/chronograf/v1/organizations"},"organizations":[{"links":{"self":"/chronograf/v1/organizations/1337"},"id":"1337","name":"The Good Place","public":true},{"links":{"self":"/chronograf/v1/organizations/100"},"id":"100","name":"The Bad Place","public":false}]}`,
},
}
@ -228,6 +231,7 @@ func TestService_UpdateOrganization(t *testing.T) {
ID: 1337,
Name: "The Good Place",
DefaultRole: roles.ViewerRoleName,
Public: true,
}, nil
},
},
@ -235,7 +239,7 @@ func TestService_UpdateOrganization(t *testing.T) {
id: "1337",
wantStatus: http.StatusOK,
wantContentType: "application/json",
wantBody: `{"id":"1337","name":"The Bad Place","defaultRole":"viewer","links":{"self":"/chronograf/v1/organizations/1337"},"public":false}`,
wantBody: `{"id":"1337","name":"The Bad Place","defaultRole":"viewer","links":{"self":"/chronograf/v1/organizations/1337"},"public":true}`,
},
{
name: "Update Organization public",
@ -261,6 +265,7 @@ func TestService_UpdateOrganization(t *testing.T) {
ID: 1337,
Name: "The Good Place",
DefaultRole: roles.ViewerRoleName,
Public: true,
}, nil
},
},
@ -292,6 +297,7 @@ func TestService_UpdateOrganization(t *testing.T) {
ID: 1337,
Name: "The Good Place",
DefaultRole: roles.ViewerRoleName,
Public: true,
}, nil
},
},
@ -325,6 +331,7 @@ func TestService_UpdateOrganization(t *testing.T) {
ID: 1337,
Name: "The Good Place",
DefaultRole: roles.MemberRoleName,
Public: false,
}, nil
},
},