def test_get_serializer_for_model_method_with_label(self): config = SearchConf('search.tests.mocks', auto_setup=True) MockSerializer = getattr(config._serializer_module, 'MockSerializer', None) serializer = config.get_serializer_for_model('search.MockModel') self.assertEqual(serializer, MockSerializer)
def test_get_serializer_for_model_method_with_class(self): config = SearchConf("search.tests.mocks", auto_setup=True) self.assertEqual(MockModel._meta.label, "search.MockModel") MockSerializer = getattr(config._serializer_module, "MockSerializer", None) serializer = config.get_serializer_for_model(MockModel) self.assertEqual(serializer, MockSerializer)
def test_get_serializer_for_model_method_with_unrelated_model(self): config = SearchConf('search.tests.mocks', auto_setup=True) with self.assertRaises(LookupError): config.get_serializer_for_model('search.MockUnserializedModel')
def test_get_serializer_for_model_method_with_nonexistent_model(self): config = SearchConf('search.tests.mocks', auto_setup=True) with self.assertRaises(LookupError): config.get_serializer_for_model('search.ModelThatDoesNotExist')
def test_get_serializer_for_model_method_with_unrelated_model(self): config = SearchConf("search.tests.mocks", auto_setup=True) with self.assertRaises(LookupError): config.get_serializer_for_model("search.MockUnserializedModel")
def test_get_serializer_for_model_method_with_nonexistent_model(self): config = SearchConf("search.tests.mocks", auto_setup=True) with self.assertRaises(LookupError): config.get_serializer_for_model("search.ModelThatDoesNotExist")