def test_get_value_from_resource_value_not_exists_exception(self): resource = {'field_level_1': {'field_level_2': None}} source = { 'type': Lookup.RESOURCE_SOURCE, 'key': 'field_level_1.field_level_2' } with self.assertRaises(Exception): Lookup.get_value_from_resource(source, resource)
def test_get_value_from_resource_value_not_exists(self): resource = {'field_level_1': {'field_level_2': None}} source = { 'type': Lookup.RESOURCE_SOURCE, 'key': 'field_level_1.field_level_2', 'default-value': 'value_2' } value = Lookup.get_value_from_resource(source, resource) self.assertEqual(value, 'value_2')