]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
tests: Replace 'force_login' with 'login'
authorStephen Finucane <stephen@that.guru>
Fri, 23 Dec 2016 19:14:24 +0000 (19:14 +0000)
committerStephen Finucane <stephen@that.guru>
Fri, 23 Dec 2016 19:14:24 +0000 (19:14 +0000)
The former is only available in Django 1.9+.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Fixes: ed5e93242 ("tests: Add rudimentary pagination tests")
patchwork/tests/test_paginator.py

index b25ae1fc28f9829793f94b1457f836117bdf3a3f..8597f6a47f6e4c1798f33ee819407dd1584abe48 100644 (file)
@@ -48,7 +48,8 @@ class PaginatorTest(TestCase):
         self.assertEqual(len(response.context['page'].object_list),
                          len(self.patches))
 
-        self.client.force_login(self.user)
+        self.client.login(username=self.user.username,
+                          password=self.user.username)
         response = self._get_patches({})
         self.assertEqual(response.status_code, 200)
         self.assertEqual(len(response.context['page'].object_list),
@@ -56,7 +57,8 @@ class PaginatorTest(TestCase):
 
     def test_page_valid(self):
         page = 2
-        self.client.force_login(self.user)
+        self.client.login(username=self.user.username,
+                          password=self.user.username)
 
         for page_ in [2, str(2)]:
             response = self._get_patches({'page': page_})
@@ -65,7 +67,8 @@ class PaginatorTest(TestCase):
                              self.patches[-page].id)
 
     def test_page_invalid(self):
-        self.client.force_login(self.user)
+        self.client.login(username=self.user.username,
+                          password=self.user.username)
         response = self._get_patches({'page': 'foo'})
         self.assertEqual(response.status_code, 200)
         self.assertEqual(response.context['page'].object_list[0].id,