Fixed the mistyped line referred to in bug 787023
This commit is contained in:
commit
db18a79241
@ -104,7 +104,7 @@ class ViewBuilderV11(ViewBuilder):
|
||||
# check for existing key
|
||||
for limit in limits:
|
||||
if limit["uri"] == rate_limit["URI"] and \
|
||||
limit["regex"] == limit["regex"]:
|
||||
limit["regex"] == rate_limit["regex"]:
|
||||
_rate_limit_key = limit
|
||||
break
|
||||
|
||||
|
@ -305,6 +305,57 @@ class LimitsControllerV11Test(BaseLimitTestSuite):
|
||||
body = json.loads(response.body)
|
||||
self.assertEqual(expected, body)
|
||||
|
||||
def _populate_limits_diff_regex(self, request):
|
||||
"""Put limit info into a request."""
|
||||
_limits = [
|
||||
limits.Limit("GET", "*", ".*", 10, 60).display(),
|
||||
limits.Limit("GET", "*", "*.*", 10, 60).display(),
|
||||
]
|
||||
request.environ["nova.limits"] = _limits
|
||||
return request
|
||||
|
||||
def test_index_diff_regex(self):
|
||||
"""Test getting limit details in JSON."""
|
||||
request = self._get_index_request()
|
||||
request = self._populate_limits_diff_regex(request)
|
||||
response = request.get_response(self.controller)
|
||||
expected = {
|
||||
"limits": {
|
||||
"rate": [
|
||||
{
|
||||
"regex": ".*",
|
||||
"uri": "*",
|
||||
"limit": [
|
||||
{
|
||||
"verb": "GET",
|
||||
"next-available": 0,
|
||||
"unit": "MINUTE",
|
||||
"value": 10,
|
||||
"remaining": 10,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"regex": "*.*",
|
||||
"uri": "*",
|
||||
"limit": [
|
||||
{
|
||||
"verb": "GET",
|
||||
"next-available": 0,
|
||||
"unit": "MINUTE",
|
||||
"value": 10,
|
||||
"remaining": 10,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
],
|
||||
"absolute": {},
|
||||
},
|
||||
}
|
||||
body = json.loads(response.body)
|
||||
self.assertEqual(expected, body)
|
||||
|
||||
def _test_index_absolute_limits_json(self, expected):
|
||||
request = self._get_index_request()
|
||||
response = request.get_response(self.controller)
|
||||
|
Loading…
Reference in New Issue
Block a user