def test_should_log_given_boolean_configuration_property(self): log_configuration(self.mock_log, {self.configuration_property: True}, 'configuration_file.yaml') self.mock_log.assert_any_call('Configuration property %s = "%s" (%s)', '"property"', True, 'bool')
def test_should_log_given_integer_configuration_property(self): log_configuration(self.mock_log, {self.configuration_property: 123}, 'configuration_file.yaml') self.mock_log.assert_any_call('Configuration property %s = "%s" (%s)', '"property"', 123, 'int')
def test_should_log_given_string_configuration_property(self): log_configuration(self.mock_log, {self.configuration_property: '123'}, 'configuration_file.yaml') self.mock_log.assert_any_call('Configuration property %s = "%s" (%s)', '"property"', '123', 'str')
def test_should_log_given_configuration_properties_in_alphabetical_order(self): property_a = ConfigurationProperty(key="a_property", default=123) property_b = ConfigurationProperty(key="b_property", default=123) property_c = ConfigurationProperty(key="c_property", default=123) configuration = {property_a: 123, property_b: False, property_c: "hello world"} log_configuration(self.mock_log, configuration, "configuration_file.yaml") self.mock_log.assert_any_call('Loaded configuration file "%s"', "configuration_file.yaml") self.mock_log.assert_any_call('Configuration property %s = "%s" (%s)', '"a_property"', 123, "int") self.mock_log.assert_any_call('Configuration property %s = "%s" (%s)', '"b_property"', False, "bool") self.mock_log.assert_any_call('Configuration property %s = "%s" (%s)', '"c_property"', "hello world", "str")
def test_should_log_given_configuration_properties_in_alphabetical_order( self): property_a = ConfigurationProperty(key='a_property', default=123) property_b = ConfigurationProperty(key='b_property', default=123) property_c = ConfigurationProperty(key='c_property', default=123) configuration = { property_a: 123, property_b: False, property_c: 'hello world' } log_configuration(self.mock_log, configuration, 'configuration_file.yaml') self.mock_log.assert_any_call('Loaded configuration file "%s"', 'configuration_file.yaml') self.mock_log.assert_any_call('Configuration property %s = "%s" (%s)', '"a_property"', 123, 'int') self.mock_log.assert_any_call('Configuration property %s = "%s" (%s)', '"b_property"', False, 'bool') self.mock_log.assert_any_call('Configuration property %s = "%s" (%s)', '"c_property"', 'hello world', 'str')
def test_should_log_when_configuration_file_was_empty(self): log_configuration(self.mock_log, {}, 'configuration_file.yaml') self.mock_log.assert_any_call('Configuration file was empty!')
def test_should_log_given_path(self): log_configuration(self.mock_log, {}, 'configuration_file.yaml') self.mock_log.assert_any_call('Loaded configuration file "%s"', 'configuration_file.yaml')
def test_should_log_given_integer_configuration_property(self): log_configuration(self.mock_log, {self.configuration_property: 123}, "configuration_file.yaml") self.mock_log.assert_any_call('Configuration property %s = "%s" (%s)', '"property"', 123, "int")
def test_should_log_given_boolean_configuration_property(self): log_configuration(self.mock_log, {self.configuration_property: True}, "configuration_file.yaml") self.mock_log.assert_any_call('Configuration property %s = "%s" (%s)', '"property"', True, "bool")
def test_should_log_given_string_configuration_property(self): log_configuration(self.mock_log, {self.configuration_property: "123"}, "configuration_file.yaml") self.mock_log.assert_any_call('Configuration property %s = "%s" (%s)', '"property"', "123", "str")
def test_should_log_when_configuration_file_was_empty(self): log_configuration(self.mock_log, {}, "configuration_file.yaml") self.mock_log.assert_any_call("Configuration file was empty!")
def test_should_log_given_path(self): log_configuration(self.mock_log, {}, "configuration_file.yaml") self.mock_log.assert_any_call('Loaded configuration file "%s"', "configuration_file.yaml")