def test_should_load_configuration_file_if_it_exists(self, mock_determine_configuration_file_path, mock_exists, mock_load_configuration_properties_from_yaml_file, mock_ensure_properties_are_valid): mock_determine_configuration_file_path.return_value = 'path-to-configuration-file' mock_exists.return_value = True load_configuration_file() mock_load_configuration_properties_from_yaml_file.assert_called_with('path-to-configuration-file')
def test_should_ensure_properties_are_valid(self, mock_determine_configuration_file_path, mock_exists, mock_load_configuration_properties_from_yaml_file, mock_ensure_properties_are_valid): mock_determine_configuration_file_path.return_value = 'path-to-configuration-file' mock_exists.return_value = True mock_properties = {'foo': 'bar'} mock_load_configuration_properties_from_yaml_file.return_value = mock_properties load_configuration_file() mock_ensure_properties_are_valid.assert_called_with(mock_properties)
def test_should_check_if_the_determined_configuration_file_path_exists( self, mock_determine_configuration_file_path, mock_exists, mock_load_configuration_properties_from_yaml_file, mock_ensure_properties_are_valid): mock_determine_configuration_file_path.return_value = 'path-to-configuration-file' mock_exists.return_value = True load_configuration_file() mock_exists.assert_called_with('path-to-configuration-file')
def test_should_set_properties_to_valid_values(self, mock_determine_configuration_file_path, mock_exists, mock_load_configuration_properties_from_yaml_file, mock_ensure_properties_are_valid, mock_set_properties): mock_determine_configuration_file_path.return_value = 'path-to-configuration-file' mock_exists.return_value = True fake_raw_properties = {'foo': 'bar'} mock_load_configuration_properties_from_yaml_file.return_value = fake_raw_properties fake_valid_properties = {'spam': 'eggs'} mock_ensure_properties_are_valid.return_value = fake_valid_properties load_configuration_file() mock_set_properties.assert_called_with(fake_valid_properties)
def test_should_ensure_properties_are_valid( self, mock_determine_configuration_file_path, mock_exists, mock_load_configuration_properties_from_yaml_file, mock_ensure_properties_are_valid): mock_determine_configuration_file_path.return_value = 'path-to-configuration-file' mock_exists.return_value = True mock_properties = {'foo': 'bar'} mock_load_configuration_properties_from_yaml_file.return_value = mock_properties load_configuration_file() mock_ensure_properties_are_valid.assert_called_with(mock_properties)
def test_should_set_properties_to_valid_values( self, mock_determine_configuration_file_path, mock_exists, mock_load_configuration_properties_from_yaml_file, mock_ensure_properties_are_valid, mock_set_properties): mock_determine_configuration_file_path.return_value = 'path-to-configuration-file' mock_exists.return_value = True fake_raw_properties = {'foo': 'bar'} mock_load_configuration_properties_from_yaml_file.return_value = fake_raw_properties fake_valid_properties = {'spam': 'eggs'} mock_ensure_properties_are_valid.return_value = fake_valid_properties load_configuration_file() mock_set_properties.assert_called_with(fake_valid_properties)
def initialize_configuration(arguments): """ Load the configuration file and applies the given arguments to the configuration. """ load_configuration_file() apply_arguments_to_config(arguments)