Skip to content

Commit

Permalink
Extend test
Browse files Browse the repository at this point in the history
  • Loading branch information
kian99 committed Jan 29, 2024
1 parent 256ccf8 commit 570c2b3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/serviceaccounts/cmd/addserviceaccount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ func (s *addServiceAccountSuite) TestAddServiceAccount(c *gc.C) {
Relation: ofganames.AdministratorRelation,
Target: ofganames.ConvertTag(jimmnames.NewServiceAccountTag(clientID)),
}
// Check alice has access.
ok, err := s.JIMM.OpenFGAClient.CheckRelation(context.Background(), tuple, false)
c.Assert(err, gc.IsNil)
c.Assert(ok, gc.Equals, true)
// Check that re-running the command doesn't return an error for Alice.
_, err = cmdtesting.RunCommand(c, cmd.NewAddServiceAccountCommandForTesting(s.ClientStore(), bClient), clientID)
c.Assert(err, gc.IsNil)
// Check that re-running the command for a different user returns an error.
bClientBob := s.UserBakeryClient("bob")
_, err = cmdtesting.RunCommand(c, cmd.NewAddServiceAccountCommandForTesting(s.ClientStore(), bClientBob), clientID)
c.Assert(err, gc.ErrorMatches, "service account already owned")
}

0 comments on commit 570c2b3

Please sign in to comment.