コード例 #1
0
    def test_no_environment_with_npm_args_and_env_vars(self, mock_super_init):
        workflow_result = WorkflowResult()
        parent_work_dir_path = '/fake/path'
        config = {}

        step_implementer = NpmGeneric(
            workflow_result=workflow_result,
            parent_work_dir_path=parent_work_dir_path,
            config=config,
            npm_args=['fake-arg'],
            npm_envs={
                "ENV1": "VAL1",
                "ENV2": "VAL2"
            })

        self.assertEqual(step_implementer._NpmGeneric__npm_args, ['fake-arg'])

        self.assertEqual(step_implementer.npm_envs, {
            "ENV1": "VAL1",
            "ENV2": "VAL2"
        })

        mock_super_init.assert_called_once_with(
            workflow_result=workflow_result,
            parent_work_dir_path=parent_work_dir_path,
            config=config,
            environment=None)
コード例 #2
0
    def test_use_object_property_no_config_value(self):
        workflow_result = WorkflowResult()
        parent_work_dir_path = '/fake/path'
        config = None

        step_implementer = NpmGeneric(
            workflow_result=workflow_result,
            parent_work_dir_path=parent_work_dir_path,
            config=config,
            npm_args=['run fake:script'])

        self.assertEqual(step_implementer.npm_args, ['run fake:script'])
コード例 #3
0
    def step_implementer_config_defaults():
        """Getter for the StepImplementer's configuration defaults.

        Returns
        -------
        dict
            Default values to use for step configuration values.

        Notes
        -----
        These are the lowest precedence configuration values.
        """
        return {**NpmGeneric.step_implementer_config_defaults(), **DEFAULT_CONFIG}
コード例 #4
0
    def test_no_environment_no_npm_args(self, mock_super_init):
        workflow_result = WorkflowResult()
        parent_work_dir_path = '/fake/path'
        config = {}

        step_implementer = NpmGeneric(
            workflow_result=workflow_result,
            parent_work_dir_path=parent_work_dir_path,
            config=config)

        self.assertIsNone(step_implementer._NpmGeneric__npm_args)
        mock_super_init.assert_called_once_with(
            workflow_result=workflow_result,
            parent_work_dir_path=parent_work_dir_path,
            config=config,
            environment=None)
コード例 #5
0
    def test_use_object_property_with_config_value(self):
        workflow_result = WorkflowResult()
        parent_work_dir_path = '/fake/path'
        step_config = {'npm-args': ['config-value-fake-arg']}
        config = Config({
            Config.CONFIG_KEY: {
                'foo': [{
                    'implementer': 'NpmGeneric',
                    'config': step_config
                }]
            }
        })

        step_implementer = NpmGeneric(
            workflow_result=workflow_result,
            parent_work_dir_path=parent_work_dir_path,
            config=config,
            npm_args=['object-property-fake-arg'])

        self.assertEqual(step_implementer.npm_args,
                         ['object-property-fake-arg'])
コード例 #6
0
 def test_result(self):
     self.assertEqual(NpmGeneric._required_config_or_result_keys(),
                      ['package-file', 'npm-args'])
コード例 #7
0
 def test_result(self):
     self.assertEqual(NpmGeneric.step_implementer_config_defaults(), {
         'package-file': 'package.json',
     })