Example #1
0
    def test_run_list(
        self,
        action: RunwayActionTypeDef,
        mocker: MockerFixture,
        runway_context: MockRunwayContext,
    ) -> None:
        """Test run_list."""
        dep0 = MagicMock()
        dep0.modules = ["module"]
        dep1 = MagicMock()
        dep1.modules = []
        deployments = [dep0, dep1]

        mock_action = MagicMock()
        mocker.patch.object(Deployment, action, mock_action)
        mock_vars = MagicMock()

        assert not Deployment.run_list(
            action=action,
            context=runway_context,
            deployments=deployments,  # type: ignore
            future=None,  # type: ignore
            variables=mock_vars,
        )
        dep0.resolve.assert_called_once_with(runway_context,
                                             variables=mock_vars,
                                             pre_process=True)
        dep1.resolve.assert_called_once_with(runway_context,
                                             variables=mock_vars,
                                             pre_process=True)
        mock_action.assert_called_once_with()
Example #2
0
    def test_run_list(self, action, monkeypatch, runway_context):
        """Test run_list."""
        dep0 = MagicMock()
        dep0.modules = ["module"]
        dep1 = MagicMock()
        dep1.modules = []
        deployments = [dep0, dep1]

        mock_action = MagicMock()
        monkeypatch.setattr(Deployment, action, mock_action)
        mock_vars = MagicMock()

        assert not Deployment.run_list(
            action=action,
            context=runway_context,
            deployments=deployments,
            future=None,
            variables=mock_vars,
        )
        dep0.resolve.assert_called_once_with(
            runway_context, variables=mock_vars, pre_process=True
        )
        dep1.resolve.assert_called_once_with(
            runway_context, variables=mock_vars, pre_process=True
        )
        mock_action.assert_called_once_with()