コード例 #1
0
 def test_it_returns_the_model_if_found(self):
     from tests.models import TestPerson
     result = ModelFinder.find('tests', 'TestPerson')
     self.assertEqual(result, TestPerson)
コード例 #2
0
 def test_find_raises_error_if_model_name_is_blank(self):
     with self.assertRaises(CommandError):
         ModelFinder.find('nsync', '')
コード例 #3
0
 def test_it_raises_an_error_if_the_model_cannot_be_found(self):
     with self.assertRaises(LookupError):
         ModelFinder.find('fakeApp', 'missingModel')
コード例 #4
0
 def test_find_raises_error_if_app_label_is_blank(self):
     with self.assertRaises(CommandError):
         ModelFinder.find('', 'model')
コード例 #5
0
 def test_it_returns_the_model_if_found(self):
     from tests.models import TestPerson
     result = ModelFinder.find('tests', 'TestPerson')
     self.assertEqual(result, TestPerson)
コード例 #6
0
 def test_it_raises_an_error_if_the_model_cannot_be_found(self):
     with self.assertRaises(LookupError):
         ModelFinder.find('fakeApp', 'missingModel')
コード例 #7
0
 def test_find_raises_error_if_model_name_is_blank(self):
     with self.assertRaises(CommandError):
         ModelFinder.find('nsync', '')
コード例 #8
0
 def test_find_raises_error_if_app_label_is_blank(self):
     with self.assertRaises(CommandError):
         ModelFinder.find('', 'model')