Пример #1
0
 def test_whenCalledWithDestroyCommand_shouldAppendVarsAndCreds(
         self, mocked_get_env):
     """Case where var-file, -var workpace=xyz and -var shared_credentials is appended"""
     self.input_args.command = "destroy"
     mocked_get_env.return_value = "mytestenv"
     atmos.determine_actions(self.input_args, [])
     atmos.run_cmd.assert_called_with(
         'terraform destroy -var-file=vars/mytestenv.tfvars -var "workspace=mytestenv" -var "shared_credentials_file=$HOME/.aws/credentials"'
     )
Пример #2
0
 def test_whenEnvironmentArgIsGiven_shouldGenerateCredentials(
         self, mocked_generate):
     self.input_args.e = True
     atmos.determine_actions(self.input_args, [])
     mocked_generate.assert_called_once()
Пример #3
0
 def test_whenInAGitRepo_andManualArgIsNotGiven_andEnvironmentArgIsNotGiven_shouldCallTheWorkspaceManager(
         self, mocked_workspace_manager):
     atmos.is_git_directory.return_value = True
     atmos.determine_actions(self.input_args, [])
     mocked_workspace_manager.assert_called_once()
Пример #4
0
 def test_whenCalledWithParams_theyAreAppended(self):
     """Should append all params after the command"""
     atmos.determine_actions(self.input_args, ["--myparam", "myvalue"])
     atmos.run_cmd.assert_called_with(
         "terraform mytestcommand --myparam myvalue")
Пример #5
0
 def test_whenCalledWithNoAdditionalArgs_shouldRunTheTerraformCommand(self):
     """Simplest case where atmos is only called with a command and no further arguments"""
     atmos.determine_actions(self.input_args, [])
     atmos.run_cmd.assert_called_with("terraform mytestcommand")