Пример #1
0
    def test_emtpy_request_returns_job_response_error(self):
        """
        Test that server can handle an emtpy job missing top level elements without throwing exceptions
        """
        settings = factories.ServerSettingsFactory()
        server = HandleNextRequestServer(settings=settings)
        server.transport = SimplePassthroughServerTransport(server.service_name)

        server.transport.set_request({})
        server.handle_next_request()
        response = server.transport.get_response()

        # Make sure we got an error
        self.assertTrue('errors' in response)
        errors = response['errors']
        self.assertEqual(len(errors), 3)
        self.assertEqual(set(['actions', 'control', 'context']), set([e.get('field', None) for e in errors]))
Пример #2
0
 def setUp(self):
     # Make a new server instance each time
     settings = factories.ServerSettingsFactory()
     settings['middleware'].append({'object': ProcessJobMiddleware})
     self.server = ProcessJobServer(settings=settings)
Пример #3
0
 def setUp(self):
     self.settings = factories.ServerSettingsFactory()