Chromium Code Reviews| Index: appengine/swarming/handlers_endpoints_test.py |
| diff --git a/appengine/swarming/handlers_endpoints_test.py b/appengine/swarming/handlers_endpoints_test.py |
| index 14e13b99905637dc82b2ad58a1a67a624114c98e..aec86747d48b32991e36855273f14f6490fa9a57 100755 |
| --- a/appengine/swarming/handlers_endpoints_test.py |
| +++ b/appengine/swarming/handlers_endpoints_test.py |
| @@ -1491,6 +1491,38 @@ class BotsApiTest(BaseTest): |
| request = swarming_rpcs.BotsRequest(dimensions=['bad']) |
| self.call_api('count', body=message_to_dict(request), status=400) |
| + def test_dimensions_ok(self): |
| + """Asserts that BotsDimensions is returned with the right data.""" |
| + self.set_as_privileged_user() |
| + self.mock_now(datetime.datetime(2009, 1, 2, 3, 4, 5, 6)) |
| + |
| + aggregate = bot_management.DimensionAggregation( |
| + key=bot_management.DimensionAggregation.KEY, |
|
M-A Ruel
2016/08/05 18:06:01
+4
kjlubick
2016/08/05 18:28:42
Done.
|
| + dimensions=[ |
| + bot_management.DimensionValues(dimension='foo', |
|
M-A Ruel
2016/08/05 18:06:01
please align consistently.
kjlubick
2016/08/05 18:28:42
Done.
|
| + values=['alpha', 'beta']), |
| + bot_management.DimensionValues(dimension='bar', |
| + values=['gamma', 'delta', 'epsilon']), |
| + ]) |
| + aggregate.put() |
|
M-A Ruel
2016/08/05 18:06:01
no need for a named variable
kjlubick
2016/08/05 18:28:42
Done.
|
| + |
| + expected = { |
| + u'bots_dimensions': [ |
| + { |
| + u'key': 'foo', |
| + u'value': [u'alpha', u'beta'], |
| + }, |
| + { |
| + u'key': 'bar', |
| + u'value': [u'gamma', u'delta', u'epsilon'], |
| + }, |
| + ] |
| + } |
| + |
| + response = self.call_api('dimensions', body={}) |
|
M-A Ruel
2016/08/05 18:06:01
you can probably (?) inline the call and this woul
kjlubick
2016/08/05 18:28:42
Done.
|
| + self.assertEqual(expected, response.json) |
| + |
| + |
| class BotApiTest(BaseTest): |
| api_service_cls = handlers_endpoints.SwarmingBotService |