Skip to content

Commit

Permalink
Fix test to check no prompt is made when there is no registered contr…
Browse files Browse the repository at this point in the history
…ollers on the client.
  • Loading branch information
anastasiamac committed Mar 3, 2020
1 parent cfec265 commit 70a72c5
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions cmd/modelcmd/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,29 +221,19 @@ func (s *OptionalControllerCommandSuite) TestPromptManyControllersNoCurrent(c *g
})
}

func (s *OptionalControllerCommandSuite) TestPromptNoControllersAndNoCurrent(c *gc.C) {
func (s *OptionalControllerCommandSuite) TestPromptNoRegisteredControllers(c *gc.C) {
// Since there are no controllers registered on the client, the operation is
// assumed to be desired only on the client.
s.assertPrompted(c, jujuclient.NewMemStore(), testData{
userAnswer: "y\n",
expectedPrompt: "Do you ONLY want to this client? (Y/n): \n",
userAnswer: "n\n",
expectedPrompt: "",
expectedInfo: "This operation can be applied to both a copy on this client and to the one on a controller.\n" +
"No current controller was detected and there are no registered controllers on this client: either bootstrap one or register one.\n",
expectedControllerName: "",
expectedClientOperation: true,
})
}

func (s *OptionalControllerCommandSuite) TestPromptDenyClientAndNoCurrent(c *gc.C) {
s.assertPrompted(c, jujuclient.NewMemStore(), testData{
userAnswer: "n\n",
expectedPrompt: "Do you ONLY want to this client? (Y/n): \n",
expectedInfo: "This operation can be applied to both a copy on this client and to the one on a controller.\n" +
"No current controller was detected and there are no registered controllers on this client: either bootstrap one or register one.\n" +
"Neither client nor controller specified - nothing to do.\n",
expectedControllerName: "",
expectedClientOperation: false,
})
}

func setupTestStore() jujuclient.ClientStore {
store := jujuclient.NewMemStore()
store.Controllers = map[string]jujuclient.ControllerDetails{
Expand Down

0 comments on commit 70a72c5

Please sign in to comment.