def test_provider_touch_error(self): MockResponses.provider_touch(self.provider, identity='123', code=503) with self.assertRaises(ProviderError) as e: self.provider.touch('qwerty', '123') self.assertEqual(e.exception.code, 503)
def test_provider_touch_limit_error(self): MockResponses.provider_touch( self.provider, identity='123', code=self.provider.touch_limit_error[0], body=self.provider.touch_limit_error[1]) with self.assertRaises(TouchLimitError) as e: self.provider.touch('qwerty', '123') self.assertEqual(e.exception.code, self.provider.touch_limit_error[0])
def test_task_touch_resume_disable(self): for provider in providers.values(): resume = FakeModels.resume(provider=provider, autoupdate=True, old=True) MockResponses.provider_touch(provider, identity=resume.identity, code=500) result = tasks.touch_resume() same_resume = Resume.query.get(resume.identity) self.assertFalse(same_resume.autoupdate) self.assertTaskResult(result, total=1, success=0, skipped=1)
def test_task_touch_resume(self): for provider in providers.values(): FakeModels.resume(provider=provider, autoupdate=True) resume = FakeModels.resume(provider=provider, autoupdate=True, old=True) MockResponses.provider_touch(provider, identity=resume.identity) result = tasks.touch_resume() prov = len(providers) self.assertTaskResult(result, total=prov * 2, success=prov, skipped=prov)
def test_provider_touch(self): MockResponses.provider_touch(self.provider, identity='123') result = self.provider.touch('qwerty', '123') self.assertTrue(result)