コード例 #1
0
    def test_provider_fetch_error(self):
        body = FakeResponses.resume(self.provider.name)
        MockResponses.provider_fetch(self.provider, body=body, code=500)

        with self.assertRaises(ProviderError) as e:
            self.provider.fetch('qwerty')

        self.assertEqual(e.exception.code, 500)
コード例 #2
0
    def test_provider_fetch(self):
        body = FakeResponses.resume(self.provider.name)
        MockResponses.provider_fetch(self.provider, body=body)

        result = self.provider.fetch('qwerty')

        self.assertIsInstance(result, list)
        self.assertEqual(len(result), 1)
コード例 #3
0
ファイル: test_views.py プロジェクト: perewall/touchresume
    def test_view_resume_provider_error(self):
        for provider in providers.values():
            MockResponses.provider_fetch(provider, body=dict(), code=401)

            user = FakeModels.user()
            account = FakeModels.account(provider=provider, user=user)

            self.auth_user(user=user)
            response = self.client.get(url_for('views.resume'))
            same_account = Account.query.get(account.identity)

            self.assertEqual(response.status_code, 200)
            self.assertFalse(same_account.resume)