def test_get_user_password_decrypted(self):
     self.assertEqual(
         type(get_user_password_decrypted()),
         type(decrypt_user_password(**retrieve_password_file())))
     self.assertEqual(
         len(get_user_password_decrypted()),
         len(decrypt_user_password(**retrieve_password_file())))
 def test_collect_token_automatically_with_correct_id(self):
     if retrieve_password_file():
         user, password = get_user_password_decrypted()
         self.assertEqual(type(collect_token_automatically(user, password)),
                          type(Scraper('')))
     else:
         self.fail('No user/password informed. Use autotoken.')
 def test_check_function_for_semi_automatic_token(self):
     if retrieve_password_file():
         user, pwd = get_user_password_decrypted()
         self.assertEqual(
             check_semi_automatic_collection(email=user, password=pwd),
             True)
     else:
         self.fail('No user/password informed. Use autotoken.')
示例#4
0
 def setUp(self):
     self.scraper = Scraper(retrieve_token_file())
     self.github = '262588213843476'
     self.day_scraped = strftime("%Y-%m-%d_%Hh")
     if not self.scraper.check_valid_token():
         if retrieve_password_file():
             try:
                 collect_token_automatically(*get_user_password_decrypted())
             except Exception as inst:
                 print(inst)
                 self.fail('Token has expired, please renew it.')
         else:
             self.fail('There is no token.')
 def test_if_token_has_password(self):
     self.assertFalse(retrieve_password_file('test.txt'))
     if not retrieve_password_file():
         self.fail('No user/password informed. Use autotoken.')
 def test_check_function_for_automatic_token(self):
     if retrieve_password_file():
         self.assertTrue(check_automatic_collection())
     else:
         self.fail('No user/password informed. Use autotoken.')