def test_works_with_keyring_password(self):
     """This test requires a valid keyring password to be set up on the testing computer"""
     try:
         with HandshakeSession(homepage, email):
             pass
     except InvalidPasswordError:
         self.fail("Password did not work or was not found")
 def test_custom_chromedriver_path(self):
     try:
         with HandshakeSession(
                 homepage, email,
                 chromedriver_path='chromedriver.exe') as browser:
             pass
     except Exception as e:
         self.fail(e)
    def test_does_not_throw_error_given_valid_url(self):
        standard_url = homepage

        login_style_url = f"{homepage}/login"

        try:
            with HandshakeSession(login_url=standard_url,
                                  email=email,
                                  password=password):
                pass
        except ValueError:
            self.fail("Unexpected ValueError given a valid normal URL")

        try:
            with HandshakeSession(login_url=login_style_url,
                                  email=email,
                                  password=password):
                pass
        except ValueError:
            self.fail("Unexpected ValueError given a valid login-style URL")
 def test_custom_download_dir(self):
     custom_download_dir = 'C:\\Users\\cedwar42\\Documents'
     with HandshakeSession(homepage,
                           email,
                           download_dir=custom_download_dir) as browser:
         events_page = EventsPage(browser)
         try:
             events_page.download_event_data(custom_download_dir,
                                             wait_time=30)
         except RuntimeError as e:
             self.fail(e)
Esempio n. 5
0
    'hs_event_attendees': 'Events Attendance',
    'hs_experiences': 'Experiences',
    'hs_student_usage': 'Students Usage',
    'hs_milestone_events': 'Events',
    'hs_applications_plt': 'Pipeline Exports\\Applications',
    'hs_experiences_plt': 'Pipeline Exports\\Experiences',
    'hs_profile_notes': 'Pipeline Exports\\Profile Notes',
    'hs_experience_page': 'Pipeline Exports\\Experiences',
    'hs_requested_experience_label': 'Pipeline Exports\\Experiences'
}

#Iterate through web pages and download datasets
with HandshakeSession(
        school_url,
        email,
        password,
        max_wait_time=120,
        chromedriver_path="C:\\Users\\ccaldarelli\\chromedriver.exe"
) as browser:
    for fname, url in dim_dict.items():
        cur_insight_page = InsightsPage(insights_url + url, browser)
        report_data = cur_insight_page.download_file(
            download_dir="C:\\Users\\ccaldarelli\\downloads",
            file_name=fname,
            file_type=FileType.CSV)

#Move files from downloads to network drives
for key, value in dir_pairs.items():
    source = "C:\\Users\\ccaldarelli\\Downloads\\" + key + ".csv"
    destination = "L:\\UGC Data Analysis & Reports\\Raw Data\\HandShake\\" + value
    dest = shutil.copy(source, destination)
 def test_throws_error_if_keyring_cannot_find_password(self):
     """This test requires the testing computer to NOT have the specified service/user combination set"""
     with self.assertRaises(InvalidPasswordError):
         with HandshakeSession('https://abc.joinhandshake.com',
                               '*****@*****.**'):
             pass
 def test_sets_browser_school_id(self):
     try:
         with HandshakeSession(homepage, email, password) as browser:
             self.assertEqual(browser.school_id, school_id)
     except AttributeError:
         self.fail("School ID has not been set")