예제 #1
0
    def test_default_data_with_cli_args(self):
        # pylint: disable=no-self-use,protected-access
        config = Configuration({})
        cli_args = self.cli_args_sentinals()
        merged_data = copy.deepcopy(config.data)
        config._merge_cli_args(merged_data, cli_args)

        # `cli_args_sentinals` instead of `cli_args` just for in case
        # `cli_args` was tampered with.
        cli_args_sentinals = self.cli_args_sentinals()
        assert merged_data['virtualenv']['python'] \
            == cli_args_sentinals['python']
        assert merged_data['virtualenv']['path'] \
            == cli_args_sentinals['virtualenv_dir']
        assert merged_data['virtualenv']['keep'] \
            == cli_args_sentinals['keep_virtualenv']
        assert merged_data['virtualenv']['pip']['requirements'] \
            == cli_args_sentinals['requirements']
        assert merged_data['virtualenv']['pip']['packages'] \
            == cli_args_sentinals['packages']
        assert merged_data['packager']['target'] \
            == cli_args_sentinals['output']
        assert merged_data['packager']['build_path'] \
            == cli_args_sentinals['archive_dir']
        assert merged_data['packager']['keep'] \
            == cli_args_sentinals['keep_archive']
        assert merged_data['packager']['followlinks'] \
            == cli_args_sentinals['followlinks']
        assert merged_data['packager']['includes'] \
            == cli_args_sentinals['includes']
        assert merged_data['packager']['excludes'] \
            == cli_args_sentinals['excludes']
예제 #2
0
    def test_no_changes(self):
        # pylint: disable=no-self-use,protected-access
        config = Configuration({})
        default_data_ori = copy.deepcopy(config.data)
        default_data_in = copy.deepcopy(config.data)

        config._merge_cli_args(default_data_in, {})
        assert default_data_in == default_data_ori
예제 #3
0
 def test_calls_injector_map(self, map_mock):
     # pylint: disable=protected-access
     config = Configuration({})
     cli_args = self.cli_args_sentinals()
     config._merge_cli_args({}, cli_args)
     assert map_mock.call_count == 11
예제 #4
0
 def test_utilizes_injector(self, injector):
     # pylint: disable=no-self-use,protected-access
     config = Configuration({})
     config._merge_cli_args(sentinel.data, sentinel.args)
     injector.assert_called_with(sentinel.data, sentinel.args)
예제 #5
0
 def test_empty_stays_empty(self):
     # pylint: disable=no-self-use,protected-access
     config = Configuration({})
     data_in = {}
     config._merge_cli_args({}, {})
     assert data_in == {}