#3774
[auf_rh_dae.git] / project / rh / test / common.py
index cadadb6..3d79cc2 100644 (file)
@@ -50,6 +50,7 @@ class RhTest(TestCase):
         self.grp_drh2
         self.grp_accior
         self.grp_abf
+        self.grp_finance
         self.grp_haute_direction
         self.grp_service_utilisateurs
         
@@ -145,6 +146,9 @@ class RhTest(TestCase):
         self.grp_abf = Group(name=groups.ABF)
         self.grp_abf.save()
 
+        self.grp_finance = Group(name=groups.FINANCE)
+        self.grp_finance.save()
+
         self.grp_haute_direction = Group(name=groups.HAUTE_DIRECTION)
         self.grp_haute_direction.save()
 
@@ -289,7 +293,9 @@ class RhTest(TestCase):
         response = self.client.get(url, follow=True)
         is_ko = response.status_code in (403, 404) or \
                 'next' in response.context or \
+                'next' in response.context['request'].GET.keys() or \
                 SAML_REDIRECT_FIELD_NAME in response.context['request'].GET.keys()
+        
         self.assertEqual(is_ko, True)
 
     def _test_anonyme(self):
@@ -359,6 +365,16 @@ class RhTest(TestCase):
         credentials = {'username': email, 'password': self.password}
         self.assertTrue(self.client.login(**credentials), "login failed")
 
+    def _test_grp_finance(self):
+        email = "0@test.auf"
+        
+        u = User.objects.get(email=email)
+        self.grp_finance.user_set.add(u)
+        self.grp_finance.save()
+
+        credentials = {'username': email, 'password': self.password}
+        self.assertTrue(self.client.login(**credentials), "login failed")
+
     def _test_grp_haute_direction(self):
         email = "0@test.auf"