コード例 #1
0
 def test_global_tool_install(self):
     action = GlobalToolInstallAction(self.subprocess_dotnet)
     action.execute()
     self.subprocess_dotnet.run.assert_called_once_with([
         "tool", "install", "-g", "Amazon.Lambda.Tools",
         "--ignore-failed-sources"
     ])
コード例 #2
0
    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'])
コード例 #3
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"]
     )
コード例 #4
0
    def test_global_tool_parallel(self):
        actions = [
            GlobalToolInstallAction(self.subprocess_dotnet),
            GlobalToolInstallAction(self.subprocess_dotnet),
            GlobalToolInstallAction(self.subprocess_dotnet),
        ]

        with ThreadPoolExecutor() as executor:
            for action in actions:
                executor.submit(action.execute)

        self.subprocess_dotnet.run.assert_called_once_with(
            ["tool", "install", "-g", "Amazon.Lambda.Tools", "--ignore-failed-sources"]
        )
コード例 #5
0
 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)
コード例 #6
0
    def test_global_tool_install(self):
        self.subprocess_dotnet.reset_mock()

        action = GlobalToolInstallAction(self.subprocess_dotnet)
        action.execute()
        self.subprocess_dotnet.run.assert_called_once_with(['tool', 'install', '-g', 'Amazon.Lambda.Tools'])