Skip to content

Commit 9b8f179

Browse files
committed
feat(server): update organizations_test with reader role
1 parent 15dbecf commit 9b8f179

File tree

1 file changed

+41
-3
lines changed

1 file changed

+41
-3
lines changed

Diff for: kv/organizations_test.go

+41-3
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ func TestOrganizationsStore_Update(t *testing.T) {
273273
addFirst: true,
274274
},
275275
{
276-
name: "Update organization default role",
276+
name: "Update organization default role to viewer",
277277
fields: fields{},
278278
args: args{
279279
ctx: context.Background(),
@@ -291,7 +291,25 @@ func TestOrganizationsStore_Update(t *testing.T) {
291291
addFirst: true,
292292
},
293293
{
294-
name: "Update organization name and default role",
294+
name: "Update organization default role to reader",
295+
fields: fields{},
296+
args: args{
297+
ctx: context.Background(),
298+
initial: &chronograf.Organization{
299+
Name: "The Good Place",
300+
},
301+
updates: &chronograf.Organization{
302+
DefaultRole: roles.ReaderRoleName,
303+
},
304+
},
305+
want: &chronograf.Organization{
306+
Name: "The Good Place",
307+
DefaultRole: roles.ReaderRoleName,
308+
},
309+
addFirst: true,
310+
},
311+
{
312+
name: "Update organization name and default role to viewer",
295313
fields: fields{},
296314
args: args{
297315
ctx: context.Background(),
@@ -310,6 +328,26 @@ func TestOrganizationsStore_Update(t *testing.T) {
310328
},
311329
addFirst: true,
312330
},
331+
{
332+
name: "Update organization name and default role to reader",
333+
fields: fields{},
334+
args: args{
335+
ctx: context.Background(),
336+
initial: &chronograf.Organization{
337+
Name: "The Good Place",
338+
DefaultRole: roles.AdminRoleName,
339+
},
340+
updates: &chronograf.Organization{
341+
Name: "The Bad Place",
342+
DefaultRole: roles.ReaderRoleName,
343+
},
344+
},
345+
want: &chronograf.Organization{
346+
Name: "The Bad Place",
347+
DefaultRole: roles.ReaderRoleName,
348+
},
349+
addFirst: true,
350+
},
313351
{
314352
name: "Update organization name, role",
315353
fields: fields{},
@@ -405,7 +443,7 @@ func TestOrganizationsStore_Update(t *testing.T) {
405443
}
406444

407445
if tt.addFirst {
408-
tt.args.initial, err = s.Add(tt.args.ctx, tt.args.initial)
446+
tt.args.initial, _ = s.Add(tt.args.ctx, tt.args.initial)
409447
}
410448

411449
if tt.args.updates.Name != "" {

0 commit comments

Comments
 (0)