def test_calls_enqueue(self, mock_enqueue):
     queue_payload(self.request)
     args, kwargs = mock_enqueue.call_args
     self.assertEqual(args[0], receive_task)
     request = args[1]
     self.assertEqual(request.body, self.request.body)
     self.assertEqual(request.headers['server-name'], 'testserver')
     self.assertEqual(request.headers['Server-name'], 'testserver')
     self.assertEqual(request.method, 'GET')
     self.assertEqual(request.url, self.request.build_absolute_uri())
     self.assertIsNone(kwargs['uuid'])
Ejemplo n.º 2
0
 def post(self, request, *args, **kwargs):
     if queue_payload(request, uuid=kwargs.get('uuid')):
         return HttpResponse(status=202)
     return HttpResponseBadRequest()
 def test_calls_enqueue__with_uuid_from_path(self, mock_enqueue):
     request = self.get_request(None, path="/p/1234/inbox/")
     queue_payload(request)
     _args, kwargs = mock_enqueue.call_args
     self.assertEqual(kwargs['uuid'], '1234')
 def test_calls_enqueue__with_uuid(self, mock_enqueue):
     queue_payload(self.request, uuid='1234')
     _args, kwargs = mock_enqueue.call_args
     self.assertEqual(kwargs['uuid'], '1234')
Ejemplo n.º 5
0
 def test_calls_enqueue__with_uuid(self, mock_enqueue):
     queue_payload(self.request, uuid='1234')
     mock_enqueue.assert_called_once_with(receive_task, self.request.body, uuid='1234')
Ejemplo n.º 6
0
 def test_calls_enqueue(self, mock_enqueue):
     queue_payload(self.request)
     mock_enqueue.assert_called_once_with(receive_task, self.request.body, uuid=None)
Ejemplo n.º 7
0
 def test_calls_enqueue__with_uuid(self, mock_enqueue):
     queue_payload(self.request, uuid='1234')
     mock_enqueue.assert_called_once_with(receive_task,
                                          self.request.body,
                                          uuid='1234')
Ejemplo n.º 8
0
 def test_calls_enqueue(self, mock_enqueue):
     queue_payload(self.request)
     mock_enqueue.assert_called_once_with(receive_task,
                                          self.request.body,
                                          uuid=None)