コード例 #1
0
ファイル: test_core.py プロジェクト: twitty-onica/runway
    def test_destroy(self, mock_deployment, mock_reverse, runway_config,
                     runway_context):
        """Test destroy."""
        mock_reverse.return_value = "reversed"
        deployments = MagicMock()
        obj = Runway(runway_config, runway_context)

        assert not obj.destroy(deployments)
        assert runway_context.command == "destroy"
        mock_deployment.run_list.assert_called_once_with(
            action="destroy",
            context=runway_context,
            deployments=deployments,
            future=runway_config.future,
            variables=runway_config.variables,
        )
        mock_reverse.assert_not_called()
        assert not obj.destroy()
        mock_deployment.run_list.assert_called_with(
            action="destroy",
            context=runway_context,
            deployments="reversed",
            future=runway_config.future,
            variables=runway_config.variables,
        )
        mock_reverse.assert_has_calls(
            [call(runway_config.deployments),
             call(runway_config.deployments)])
コード例 #2
0
    def test_destroy(
        self,
        mocker: MockerFixture,
        runway_config: MockRunwayConfig,
        runway_context: MockRunwayContext,
    ) -> None:
        """Test destroy."""
        mock_deployment = mocker.patch(f"{MODULE}.components.Deployment")
        mock_reverse = mocker.patch.object(Runway, "reverse_deployments")
        mock_reverse.return_value = "reversed"
        deployments = MagicMock()
        obj = Runway(runway_config, runway_context)  # type: ignore

        assert not obj.destroy(deployments)
        assert runway_context.command == "destroy"
        mock_deployment.run_list.assert_called_once_with(
            action="destroy",
            context=runway_context,
            deployments=deployments,
            future=runway_config.future,
            variables=runway_config.variables,
        )
        mock_reverse.assert_not_called()
        assert not obj.destroy()
        mock_deployment.run_list.assert_called_with(
            action="destroy",
            context=runway_context,
            deployments="reversed",
            future=runway_config.future,
            variables=runway_config.variables,
        )
        mock_reverse.assert_has_calls([  # type: ignore
            call(runway_config.deployments),
            call(runway_config.deployments),
        ])