Пример #1
0
    def test_destroy(
        self,
        async_used: bool,
        fx_deployments: YamlLoaderDeployment,
        mocker: MockerFixture,
        runway_context: MockRunwayContext,
    ) -> None:
        """Test destroy."""
        mock_async = MagicMock()
        mocker.patch.object(Deployment, "_Deployment__async", mock_async)
        mock_sync = MagicMock()
        mocker.patch.object(Deployment, "_Deployment__sync", mock_sync)
        runway_context._use_concurrent = async_used
        obj = Deployment(
            context=runway_context,
            definition=fx_deployments.load("simple_parallel_regions"),
        )
        assert obj.destroy()

        if async_used:
            mock_async.assert_called_once_with("destroy")
            mock_sync.assert_not_called()
        else:
            mock_async.assert_not_called()
            mock_sync.assert_called_once_with("destroy")
Пример #2
0
    def test_destroy(self, async_used, fx_deployments, monkeypatch, runway_context):
        """Test destroy."""
        mock_async = MagicMock()
        monkeypatch.setattr(Deployment, "_Deployment__async", mock_async)
        mock_sync = MagicMock()
        monkeypatch.setattr(Deployment, "_Deployment__sync", mock_sync)
        runway_context._use_concurrent = async_used
        obj = Deployment(
            context=runway_context,
            definition=fx_deployments.load("simple_parallel_regions"),
        )
        assert obj.destroy()

        if async_used:
            mock_async.assert_called_once_with("destroy")
            mock_sync.assert_not_called()
        else:
            mock_async.assert_not_called()
            mock_sync.assert_called_once_with("destroy")