コード例 #1
0
ファイル: test_conf.py プロジェクト: jnschrag/new-silk-road
    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)
コード例 #2
0
ファイル: test_conf.py プロジェクト: CSIS-iLab/new-silk-road
    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)
コード例 #3
0
ファイル: test_conf.py プロジェクト: jnschrag/new-silk-road
 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')
コード例 #4
0
ファイル: test_conf.py プロジェクト: jnschrag/new-silk-road
    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')
コード例 #5
0
ファイル: test_conf.py プロジェクト: CSIS-iLab/new-silk-road
 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")
コード例 #6
0
ファイル: test_conf.py プロジェクト: CSIS-iLab/new-silk-road
    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")