Mark Lavin avatar Mark Lavin committed 5af98a2

Convert test lookup to new style and add legacy format tests.

Comments (0)

Files changed (1)


 __all__ = (
+    'LegacyModelLookupTestCase',
 class SimpleModelLookup(ModelLookup):
     model = Thing
-    search_field = 'name__icontains'
+    search_fields = ('name__icontains', )
 class ModelLookupTestCase(BaseSelectableTestCase):
         qs = lookup.get_query(request=None, term='other')
         self.assertTrue( not in qs.values_list('id', flat=True))
         self.assertTrue( in qs.values_list('id', flat=True))
+class LegacyModelLookup(ModelLookup):
+    model = Thing
+    search_field = 'name__icontains'
+class LegacyModelLookupTestCase(ModelLookupTestCase):
+    lookup_cls = LegacyModelLookup
+    def test_get_name(self):
+        name =
+        self.assertEqual(name, 'tests-legacymodellookup')
+    def test_get_url(self):
+        url = self.__class__.lookup_cls.url()
+        test_url = reverse('selectable-lookup', args=['tests-legacymodellookup'])
+        self.assertEqual(url, test_url)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.