'Ensure requests are logged.
Make a standard request for / and ensure there is a log entry.'

@mock.patch('nova.api.openstack.requestlog.RequestLog._should_emit')
def test_logs_requests(self, emit):

    emit.return_value = True
    self.useFixture(fixtures.OutputStreamCapture())
    log = fixtures.StandardLogging()
    self.useFixture(log)
    self.useFixture(conf_fixture.ConfFixture())
    self.useFixture(fixtures.RPCFixture('nova.test'))
    api = self.useFixture(fixtures.OSAPIFixture()).api
    resp = api.api_request('/', strip_version=True)
    log1 = 'INFO    [nova.api.openstack.requestlog]    127.0.0.1    "GET    /v2"    status:    204    len:    0    microversion:    -    time:'
    self.assertIn(log1, log.logger.output)
    content_length = resp.headers['content-length']
    log2 = ('INFO    [nova.api.openstack.requestlog]    127.0.0.1    "GET    /"    status:    200    len:    %s' % content_length)
    self.assertIn(log2, log.logger.output)
