From 1aebbf2bd4220031233a454d6a871c4f118a815b Mon Sep 17 00:00:00 2001 From: Luke Morris Date: Fri, 10 Nov 2017 18:45:25 -0800 Subject: [PATCH] Clear test noise --- bolt/organizations_test.go | 2 ++ server/me_test.go | 32 +++++++++++++++++++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/bolt/organizations_test.go b/bolt/organizations_test.go index 2fefa30e82..833f207cfe 100644 --- a/bolt/organizations_test.go +++ b/bolt/organizations_test.go @@ -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, }, diff --git a/server/me_test.go b/server/me_test.go index a8a766a576..97e63a737c 100644 --- a/server/me_test.go +++ b/server/me_test.go @@ -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) { @@ -371,8 +375,9 @@ func TestService_UpdateMe(t *testing.T) { OrganizationsStore: &mocks.OrganizationsStore{ DefaultOrganizationF: func(ctx context.Context) (*chronograf.Organization, error) { return &chronograf.Organization{ - ID: 0, - Name: "Default", + ID: 0, + Name: "Default", + Public: true, }, nil }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { @@ -382,13 +387,15 @@ func TestService_UpdateMe(t *testing.T) { switch *q.ID { case 0: return &chronograf.Organization{ - ID: 0, - Name: "Default", + ID: 0, + Name: "Default", + Public: true, }, nil case 1337: return &chronograf.Organization{ - ID: 1337, - Name: "The ShillBillThrilliettas", + 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", @@ -440,8 +447,9 @@ func TestService_UpdateMe(t *testing.T) { OrganizationsStore: &mocks.OrganizationsStore{ DefaultOrganizationF: func(ctx context.Context) (*chronograf.Organization, error) { return &chronograf.Organization{ - ID: 0, - Name: "Default", + 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 }, },