Beispiel #1
0
 def test_refresh(self, mock_box_refresh, mock_drive_refresh,
                  mock_mendeley_refresh):
     fake_authorized_box_account = BoxAccountFactory(
         date_last_refreshed=datetime.datetime.utcnow())
     fake_authorized_drive_account = GoogleDriveAccountFactory(
         date_last_refreshed=datetime.datetime.utcnow())
     fake_authorized_mendeley_account = MendeleyAccountFactory(
         date_last_refreshed=datetime.datetime.utcnow())
     fake_unauthorized_box_account = BoxAccountFactory(
         date_last_refreshed=datetime.datetime.utcnow() -
         datetime.timedelta(days=4))
     fake_unauthorized_drive_account = GoogleDriveAccountFactory(
         date_last_refreshed=datetime.datetime.utcnow() -
         datetime.timedelta(days=4))
     fake_unauthorized_mendeley_account = MendeleyAccountFactory(
         date_last_refreshed=datetime.datetime.utcnow() -
         datetime.timedelta(days=4))
     for addon in self.addons:
         Provider = look_up_provider(addon)
         main(delta=relativedelta(days=3),
              Provider=Provider,
              rate_limit=(5, 1),
              dry_run=False)
     assert_equal(1, mock_box_refresh.call_count)
     assert_equal(1, mock_drive_refresh.call_count)
     assert_equal(1, mock_mendeley_refresh.call_count)
 def test_refresh(self, mock_box_refresh, mock_drive_refresh, mock_mendeley_refresh):
     fake_box_account = BoxAccountFactory(expires_at=datetime.datetime.utcnow())
     fake_drive_account = GoogleDriveAccountFactory(expires_at=datetime.datetime.utcnow())
     fake_mendeley_account = MendeleyAccountFactory(expires_at=datetime.datetime.utcnow())
     for addon in self.addons:
         Provider = look_up_provider(addon)
         main(delta=relativedelta(days=-3), Provider=Provider, dry_run=False)
     assert_equal(1, mock_box_refresh.call_count)
     assert_equal(1, mock_drive_refresh.call_count)
     assert_equal(1, mock_mendeley_refresh.call_count)
 def test_refresh(self, mock_box_refresh, mock_drive_refresh, mock_mendeley_refresh):
     fake_authorized_box_account = BoxAccountFactory(date_last_refreshed=timezone.now())
     fake_authorized_drive_account = GoogleDriveAccountFactory(date_last_refreshed=timezone.now())
     fake_authorized_mendeley_account = MendeleyAccountFactory(date_last_refreshed=timezone.now())
     fake_unauthorized_box_account = BoxAccountFactory(date_last_refreshed=timezone.now() - datetime.timedelta(days=4))
     fake_unauthorized_drive_account = GoogleDriveAccountFactory(date_last_refreshed=timezone.now() - datetime.timedelta(days=4))
     fake_unauthorized_mendeley_account = MendeleyAccountFactory(date_last_refreshed=timezone.now() - datetime.timedelta(days=4))
     for addon in self.addons:
         Provider = look_up_provider(addon)
         main(delta=relativedelta(days=3), Provider=Provider, rate_limit=(5, 1), dry_run=False)
     assert_equal(1, mock_box_refresh.call_count)
     assert_equal(1, mock_drive_refresh.call_count)
     assert_equal(1, mock_mendeley_refresh.call_count)
 def test_refresh(self, mock_box_refresh, mock_drive_refresh,
                  mock_mendeley_refresh):
     fake_box_account = BoxAccountFactory(
         expires_at=datetime.datetime.utcnow())
     fake_drive_account = GoogleDriveAccountFactory(
         expires_at=datetime.datetime.utcnow())
     fake_mendeley_account = MendeleyAccountFactory(
         expires_at=datetime.datetime.utcnow())
     for addon in self.addons:
         Provider = look_up_provider(addon)
         main(delta=relativedelta(days=-3),
              Provider=Provider,
              dry_run=False)
     assert_equal(1, mock_box_refresh.call_count)
     assert_equal(1, mock_drive_refresh.call_count)
     assert_equal(1, mock_mendeley_refresh.call_count)
 def test_look_up_provider(self):
     for Provider in PROVIDER_CLASSES:
         result = look_up_provider(Provider.short_name)
         assert_equal(result, Provider)
     fake_result = look_up_provider('fake_addon_name')
     assert_equal(fake_result, None)
 def test_look_up_provider(self):
     for Provider in PROVIDER_CLASSES:
         result = look_up_provider(Provider.short_name)
         assert_equal(result, Provider)
     fake_result = look_up_provider('fake_addon_name')
     assert_equal(fake_result, None)