def test_should_set_file_path_of_loaded_configuration(self, mock_open, mock_yaml, mock_set_file_path_of_loaded_configuration): fake_file = self.create_fake_file() mock_open.return_value = fake_file mock_properties = {} mock_yaml.load.return_value = mock_properties _load_configuration_properties_from_yaml_file('path-to-configuration-file') mock_set_file_path_of_loaded_configuration.assert_called_with('path-to-configuration-file')
def test_should_open_file_as_specified_in_argument(self, mock_open, mock_yaml, mock_set_properties): fake_file = self.create_fake_file() mock_open.return_value = fake_file mock_properties = {} mock_yaml.load.return_value = mock_properties _load_configuration_properties_from_yaml_file('path-to-configuration-file') mock_open.assert_called_with('path-to-configuration-file')
def test_should_open_file_as_specified_in_argument(self, mock_open, mock_yaml, mock_set_properties): fake_file = self.create_fake_file() mock_open.return_value = fake_file mock_properties = {} mock_yaml.load.return_value = mock_properties _load_configuration_properties_from_yaml_file( 'path-to-configuration-file') mock_open.assert_called_with('path-to-configuration-file')
def test_should_set_file_path_of_loaded_configuration( self, mock_open, mock_yaml, mock_set_file_path_of_loaded_configuration): fake_file = self.create_fake_file() mock_open.return_value = fake_file mock_properties = {} mock_yaml.load.return_value = mock_properties _load_configuration_properties_from_yaml_file( 'path-to-configuration-file') mock_set_file_path_of_loaded_configuration.assert_called_with( 'path-to-configuration-file')
def test_should_return_raw_loaded_properties(self, mock_open, mock_yaml, mock_set_file_path_of_loaded_configuration): fake_file = self.create_fake_file() mock_open.return_value = fake_file mock_properties = {'foo': 'bar'} mock_yaml.load.return_value = mock_properties actual_properties = _load_configuration_properties_from_yaml_file('path-to-configuration-file') self.assertEqual({'foo': 'bar'}, actual_properties)
def test_should_return_raw_loaded_properties( self, mock_open, mock_yaml, mock_set_file_path_of_loaded_configuration): fake_file = self.create_fake_file() mock_open.return_value = fake_file mock_properties = {'foo': 'bar'} mock_yaml.load.return_value = mock_properties actual_properties = _load_configuration_properties_from_yaml_file( 'path-to-configuration-file') self.assertEqual({'foo': 'bar'}, actual_properties)