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..cc950c3dc893eef422e105deb5d75183c987a5aa 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( |
| + id='current', |
|
M-A Ruel
2016/08/05 14:36:05
I'd prefer if you:
- simulate two bots polling wit
kjlubick
2016/08/05 17:38:58
Done. I kept this test as well as adding a new on
|
| + dimensions=[ |
| + bot_management.DimensionValues(dimension='foo', |
| + values=['alpha', 'beta']), |
| + bot_management.DimensionValues(dimension='bar', |
| + values=['gamma', 'delta', 'epsilon']), |
| + ]) |
| + aggregate.put() |
| + |
| + expected = { |
| + u'fleet_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={}) |
| + self.assertEqual(expected, response.json) |
| + |
| + |
| class BotApiTest(BaseTest): |
| api_service_cls = handlers_endpoints.SwarmingBotService |