]> git.parisson.com Git - django-social-auth.git/commitdiff
Adding Selenium2 google-oauth and google-oauth2 tests. Both up and running.
authorMiguel Araujo Perez <miguel.araujo.perez@gmail.com>
Sun, 1 May 2011 12:17:59 +0000 (14:17 +0200)
committerMiguel Araujo Perez <miguel.araujo.perez@gmail.com>
Sun, 1 May 2011 12:17:59 +0000 (14:17 +0200)
contrib/tests/test_core.py

index 36e1b6226435db2463bfadc59bd0d9e40a604f93..c980f1b6301c889799fd8817aeaf614181e7037c 100644 (file)
@@ -41,3 +41,61 @@ class BackendsTest(TestCase):
             raise Exception("The user didn't logged in")
 
         # Here we could test the User's fields
+
+    def test_google_oauth_backend(self):
+        TEST_GOOGLE_USER = getattr(settings, 'TEST_GOOGLE_USER', None)
+        TEST_GOOGLE_PASSWORD = getattr(settings, 'TEST_GOOGLE_PASSWORD', None)
+        self.assertTrue(TEST_GOOGLE_USER)
+        self.assertTrue(TEST_GOOGLE_PASSWORD)
+
+        self.driver.get("http://social.matiasaguirre.net/login/google-oauth/")
+
+        # We log in
+        username_field = self.driver.find_element_by_id("Email")
+        username_field.send_keys(TEST_GOOGLE_USER)
+
+        password_field = self.driver.find_element_by_id("Passwd")
+        password_field.send_keys(TEST_GOOGLE_PASSWORD)
+        password_field.submit()
+
+        # The application might be already allowed
+        try:
+            self.driver.find_element_by_id("allow").click()
+        except:
+            pass
+
+        # We check the user logged in
+        heading = self.driver.find_element_by_id("heading")
+        if not heading.text == u'Logged in!':
+            raise Exception("The user didn't logged in")
+
+        # Here we could test the User's fields
+
+    def test_google_oauth2_backend(self):
+        TEST_GOOGLE_USER = getattr(settings, 'TEST_GOOGLE_USER', None)
+        TEST_GOOGLE_PASSWORD = getattr(settings, 'TEST_GOOGLE_PASSWORD', None)
+        self.assertTrue(TEST_GOOGLE_USER)
+        self.assertTrue(TEST_GOOGLE_PASSWORD)
+
+        self.driver.get("http://social.matiasaguirre.net/login/google-oauth2/")
+
+        # We log in
+        username_field = self.driver.find_element_by_id("Email")
+        username_field.send_keys(TEST_GOOGLE_USER)
+
+        password_field = self.driver.find_element_by_id("Passwd")
+        password_field.send_keys(TEST_GOOGLE_PASSWORD)
+        password_field.submit()
+
+        # The application might be already allowed
+        try:
+            self.driver.find_element_by_id("submit_approve_access").click()
+        except:
+            pass
+
+        # We check the user logged in
+        heading = self.driver.find_element_by_id("heading")
+        if not heading.text == u'Logged in!':
+            raise Exception("The user didn't logged in")
+
+        # Here we could test the User's fields