Fixed error for internal function get_model_from_collection_string.
This commit is contained in:
parent
11aacc71b6
commit
4bdb06bd9b
@ -506,8 +506,11 @@ def get_model_from_collection_string(collection_string):
|
||||
pass
|
||||
else:
|
||||
_models_to_collection_string[get_collection_string()] = model
|
||||
|
||||
return _models_to_collection_string[collection_string]
|
||||
try:
|
||||
model = _models_to_collection_string[collection_string]
|
||||
except KeyError:
|
||||
raise ValueError('Invalid message. A valid collection_string is missing.')
|
||||
return model
|
||||
|
||||
|
||||
def get_single_element_cache_key(collection_string, id):
|
||||
|
@ -58,7 +58,7 @@ class TestGetModelFromCollectionString(TestCase):
|
||||
self.assertEqual(projector_model, Projector)
|
||||
|
||||
def test_unknown_app(self):
|
||||
with self.assertRaises(KeyError):
|
||||
with self.assertRaises(ValueError):
|
||||
collection.get_model_from_collection_string('invalid/model')
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user