Skip to content

Commit

Permalink
Add test cases for invalid Username/ClientID combinations
Browse files Browse the repository at this point in the history
Signed-off-by: Babak K. Shandiz <[email protected]>
  • Loading branch information
babakks committed May 10, 2024
1 parent aa2895f commit bc493e5
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions api/connector/simpleconnector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (s *simpleConnectorSuite) TestNewSimpleRespectsClientCredentials(c *gc.C) {
},
},
{
name: "with username/password and client credentials; username/password takes over",
name: "with both username and client ID",
opts: SimpleConfig{
ControllerAddresses: []string{"some.host:9999"},
ModelUUID: "some-uuid",
Expand All @@ -68,17 +68,15 @@ func (s *simpleConnectorSuite) TestNewSimpleRespectsClientCredentials(c *gc.C) {
ClientID: "some-client-id",
ClientSecret: "some-client-secret",
},
expectedAPIInfo: api.Info{
Addrs: []string{"some.host:9999"},
ModelTag: names.NewModelTag("some-uuid"),
Tag: names.NewUserTag("some-username"),
Password: "some-password",
},
expectedDefaultDialOpts: func() api.DialOpts {
expected := api.DefaultDialOpts()
expected.LoginProvider = api.NewClientCredentialsLoginProvider("some-client-id", "some-client-secret")
return expected
expectedError: "only one of Username or ClientID should be set",
},
{
name: "with neither username nor client ID",
opts: SimpleConfig{
ControllerAddresses: []string{"some.host:9999"},
ModelUUID: "some-uuid",
},
expectedError: "one of Username or ClientID must be set",
},
}

Expand Down

0 comments on commit bc493e5

Please sign in to comment.