Exemplo n.º 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"'
     )
Exemplo n.º 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()
Exemplo n.º 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()
Exemplo n.º 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")
Exemplo n.º 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")