Пример #1
0
    def test_retry_failed_requests_attribute_error(self, m_handle_request):
        m_handle_request.side_effect = AttributeError

        gh_req = GithubRequest.objects.create(
            action=u'issues',
            body=json.dumps({'test': True}),
            method=u'post',
            time=timezone.now(),
        )

        retry_failed_requests()
        m_handle_request.assert_called_once_with(gh_req)
Пример #2
0
    def test_retry_failed_requests(self, m_handle_request):
        for i in range(5):
            GithubRequest.objects.create(
                action=u'issues',
                body=json.dumps({'test': True}),
                method=u'post',
                time=timezone.now(),
            )

        retry_failed_requests()

        self.assertEqual(m_handle_request.call_count, 5)
        for gh_req in GithubRequest.objects.all():
            m_handle_request.assert_any_call(gh_req)
Пример #3
0
 def handle(self, *args, **kwargs):
     retry_failed_requests()