Exemple #1
0
 def test_default(self):
     serializer = wsgi.ResponseHeadersSerializer()
     context = nova.context.get_admin_context()
     req = webob.Request.blank('/', environ={'nova.context': context})
     response = webob.Response(request=req)
     serializer.serialize(response, {'v': '123'}, 'asdf')
     self.assertEqual(response.status_int, 200)
Exemple #2
0
 def test_request_id(self):
     serializer = wsgi.ResponseHeadersSerializer()
     context = nova.context.get_admin_context()
     req = webob.Request.blank('/', environ={'nova.context': context})
     res = webob.Response(request=req)
     serializer.serialize(res, {}, 'foo')
     self.assertTrue(utils.is_uuid_like(
         res.headers['X-Compute-Request-Id']))
Exemple #3
0
    def test_request_id(self):
        serializer = wsgi.ResponseHeadersSerializer()

        context = nova.context.get_admin_context()
        req = webob.Request.blank('/', environ={'nova.context': context})
        res = webob.Response(request=req)
        serializer.serialize(res, {}, 'foo')
        h1 = res.headers.get('X-Compute-Request-Id')
        self.assertTrue(h1)

        context = nova.context.get_admin_context()
        req = webob.Request.blank('/', environ={'nova.context': context})
        res = webob.Response(request=req)
        serializer.serialize(res, {}, 'foo')
        h2 = res.headers.get('X-Compute-Request-Id')
        self.assertTrue(h2)

        self.assertNotEqual(h1, h2)
Exemple #4
0
 def test_default(self):
     serializer = wsgi.ResponseHeadersSerializer()
     response = webob.Response()
     serializer.serialize(response, {'v': '123'}, 'asdf')
     self.assertEqual(response.status_int, 200)