class TestGoogleDriveAuth(unittest.TestCase): def setUp(self): self.tempdir = create_random_dir() self.google_drive = GoogleDriveAPI(self.tempdir) def tearDown(self): delete_dir(self.tempdir) def test_without_credential_file_i_am_not_connected(self): self.assertFalse(self.google_drive.is_connected()) @attr(slow=True) def test_i_can_connect_with_mail_adress_and_password(self): # Given driver = webdriver.Firefox() code = authorize_drive_user(driver, self.google_drive.get_auth_url(), DRIVE_EMAIL, DRIVE_PASSWD) # When self.google_drive.authorize_with_code(code) # Then self.assertTrue(self.google_drive.is_connected()) driver.quit() @attr(slow=True) def test_user_cancel_connection(self): # Given driver = webdriver.Firefox() driver.get(self.google_drive.get_auth_url()) try: enter_text_by_id(driver, "Email", DRIVE_EMAIL) enter_text_by_id(driver, "Passwd", DRIVE_PASSWD) # When click_button_by_id(driver, "submit_deny_access") wait_for_code(driver, 'access_denied') except: raise Exception("timeout for authorization") # Then driver.quit()
def test_i_do_not_need_to_go_through_oauth_if_file_exists(self): # Given google_drive_new = GoogleDriveAPI(self.tempdir) # Then self.assertTrue(google_drive_new.is_connected())