Tests dealing with HTTP rate-limiting.
Bases: cinder.test.TestCase
Base test suite which provides relevant stubs and time abstraction.
Bases: object
Fake httplib.HTTPConnection.
Return our generated response from the request.
Requests made via this connection actually get translated and routed into our WSGI app, we then wait for the response and turn it back into an httplib.HTTPResponse.
Bases: object
Fake httplib.HTTPResponse replacement.
Returns the socket’s internal buffer.
Bases: cinder.tests.api.openstack.volume.test_limits.BaseLimitTestSuite
Tests for the limits.RateLimitingMiddleware class.
Prepare middleware for use through fake WSGI app.
Test successful GET request through middleware.
Test that middleware selected correct limiter class.
Test a rate-limited (413) GET request through middleware.
Test a rate-limited (413) response as XML
Bases: cinder.tests.api.openstack.volume.test_limits.BaseLimitTestSuite
Tests for the limits.Limit class.
Test two calls to 1 GET per second limit.
Test a limit handles 1 GET per second.
Bases: cinder.tests.api.openstack.volume.test_limits.BaseLimitTestSuite
Tests for the in-memory limits.Limiter class.
Run before each test.
Ensure the 11th GET will result in NO delay.
Ensure the 8th POST will result in a delay of 6.0 seconds until the next request will be granced.
Ensure the 11th PUT will result in a delay of 6.0 seconds until the next request will be granced.
Ensure PUT on /volumes limits at 5 requests, and PUT elsewhere is still OK after 5 requests...but then after 11 total requests, PUT limiting kicks in.
Ensure after hitting the limit and then waiting for the correct amount of time, the limit will be lifted.
Ensure multiple requests still get a delay.
Tests involving multiple users.
Simple test to ensure no delay on a single call for a limit verb we didn”t set.
Simple test to ensure no delay on a single call for a known limit.
Test user-specific limits.
Bases: cinder.tests.api.openstack.volume.test_limits.BaseLimitTestSuite
Tests for limits.LimitsController class.
Run before each test.
Test getting empty limit details in JSON.
Test getting limit details in JSON.
Test getting limit details in JSON.
Bases: cinder.test.TestCase
Bases: cinder.test.TestCase
Bases: cinder.tests.api.openstack.volume.test_limits.BaseLimitTestSuite
Tests for the default limits parser in the in-memory limits.Limiter class.
Test that parse_limits() handles bad rules correctly.
Test that parse_limits() handles bad units correctly.
Test that parse_limits() handles bad values correctly.
Test that parse_limits() handles invalid input correctly.
Test that parse_limits() handles missing args correctly.
Test that parse_limits() handles multiple rules correctly.
Bases: cinder.tests.api.openstack.volume.test_limits.BaseLimitTestSuite
Tests for the limits.WsgiLimiterProxy class.
Do some nifty HTTP/WSGI magic which allows for WSGI to be called directly by something like the httplib library.
Successful request test.
Forbidden request test.
Bases: cinder.tests.api.openstack.volume.test_limits.BaseLimitTestSuite
Tests for limits.WsgiLimiter class.
Run before each test.
Only POSTs should work.
Monkeypatches HTTPConnection so that if you try to connect to host, you are instead routed straight to the given WSGI app.
After calling this method, when any code calls
httplib.HTTPConnection(host)
the connection object will be a fake. Its requests will be sent directly to the given WSGI app rather than through a socket.
Code connecting to hosts other than host will not be affected.
This method may be called multiple times to map different hosts to different apps.
This method returns the original HTTPConnection object, so that the caller can restore the default HTTPConnection interface (for all hosts).