def test_global_tool_update_failed(self):
     self.subprocess_dotnet.run.side_effect = [
         DotnetCLIExecutionError(message="Already Installed"),
         DotnetCLIExecutionError(message="Updated Failed"),
     ]
     action = GlobalToolInstallAction(self.subprocess_dotnet)
     self.assertRaises(ActionFailedError, action.execute)
    def test_global_tool_update(self):
        self.subprocess_dotnet.reset_mock()

        self.subprocess_dotnet.run.side_effect = [DotnetCLIExecutionError(message="Already Installed"), None]
        action = GlobalToolInstallAction(self.subprocess_dotnet)
        action.execute()
        self.subprocess_dotnet.run.assert_any_call(['tool', 'install', '-g', 'Amazon.Lambda.Tools'])
        self.subprocess_dotnet.run.assert_any_call(['tool', 'update', '-g', 'Amazon.Lambda.Tools'])
    def test_build_error(self):
        self.subprocess_dotnet.reset_mock()

        self.subprocess_dotnet.run.side_effect = DotnetCLIExecutionError(message="Failed Package")
        options = {}
        action = RunPackageAction(self.source_dir, self.subprocess_dotnet, self.artifacts_dir, options, self.os_utils)

        self.assertRaises(ActionFailedError, action.execute)
Example #4
0
 def test_global_tool_update(self):
     self.subprocess_dotnet.run.side_effect = [DotnetCLIExecutionError(message="Already Installed"), None]
     action = GlobalToolInstallAction(self.subprocess_dotnet)
     action.execute()
     self.subprocess_dotnet.run.assert_any_call(
         ["tool", "install", "-g", "Amazon.Lambda.Tools", "--ignore-failed-sources"]
     )
     self.subprocess_dotnet.run.assert_any_call(
         ["tool", "update", "-g", "Amazon.Lambda.Tools", "--ignore-failed-sources"]
     )