Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: appengine/chromium_cq_status/handlers/test/stats_query_test.py

Issue 2111713004: Teach CQ status app to check login status of users. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Review and tests. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from datetime import datetime, timedelta 5 from datetime import datetime, timedelta
6 import json 6 import json
7 7
8 from google.appengine.api import memcache 8 from google.appengine.api import memcache
9 9
10 from third_party.testing_utils import testing 10 from third_party.testing_utils import testing
11 11
12 import highend 12 import highend
13 from model.cq_stats import ( 13 from model.cq_stats import (
14 CountStats, 14 CountStats,
15 CQStats, 15 CQStats,
16 ListStats, 16 ListStats,
17 ) 17 )
18 from shared.config import LAST_CQ_STATS_CHANGE_KEY 18 from shared.config import LAST_CQ_STATS_CHANGE_KEY
19 from shared.utils import minutes_per_day, timestamp_now 19 from shared.utils import timestamp_now
20
21 from handlers.stats_viewer import minutes_per_day
20 22
21 class TestStatsQuery(testing.AppengineTestCase): 23 class TestStatsQuery(testing.AppengineTestCase):
22 app_module = highend.app 24 app_module = highend.app
23 maxDiff = None 25 maxDiff = None
24 26
25 def test_query_headers(self): 27 def test_query_headers(self):
26 _clear_stats() 28 _clear_stats()
27 response = self.test_app.get('/stats/query') 29 response = self.test_app.get('/stats/query')
28 self.assertEquals(response.headers['Access-Control-Allow-Origin'], '*') 30 self.assertEquals(response.headers['Access-Control-Allow-Origin'], '*')
29 31
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 cq_stats.put() 380 cq_stats.put()
379 return cq_stats 381 return cq_stats
380 382
381 def _parse_body(response, preserve_cursor=False): # pragma: no cover 383 def _parse_body(response, preserve_cursor=False): # pragma: no cover
382 packet = json.loads(response.body) 384 packet = json.loads(response.body)
383 if not preserve_cursor: 385 if not preserve_cursor:
384 del packet['cursor'] 386 del packet['cursor']
385 for cq_stats in packet['results']: 387 for cq_stats in packet['results']:
386 del cq_stats['key'] 388 del cq_stats['key']
387 return packet 389 return packet
OLDNEW
« no previous file with comments | « appengine/chromium_cq_status/handlers/test/post_test.py ('k') | appengine/chromium_cq_status/html/recent.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698