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

Side by Side Diff: appengine/chromium_cq_status/stats/test/stats_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 6
7 from third_party.testing_utils import testing 7 from third_party.testing_utils import testing
8 8
9 import main 9 import main
10 from model.record import Record 10 from model.record import Record
11 from model.cq_stats import CountStats, CQStats, ListStats 11 from model.cq_stats import CountStats, CQStats, ListStats
12 from shared.config import STATS_START_TIMESTAMP 12 from shared.config import STATS_START_TIMESTAMP
13 from shared.config import TRYJOBVERIFIER 13 from shared.config import TRYJOBVERIFIER
14 from shared.utils import minutes_per_day
15 from handlers import update_stats 14 from handlers import update_stats
15 from handlers.stats_viewer import minutes_per_day
16 16
17 stats_start = datetime.utcfromtimestamp(STATS_START_TIMESTAMP) 17 stats_start = datetime.utcfromtimestamp(STATS_START_TIMESTAMP)
18 test_analysis_end = stats_start + timedelta(days=1) 18 test_analysis_end = stats_start + timedelta(days=1)
19 19
20 class StatsTest(testing.AppengineTestCase): # pragma: no cover 20 class StatsTest(testing.AppengineTestCase): # pragma: no cover
21 '''Utility class for stats tests that want to load/clear test Record data.''' 21 '''Utility class for stats tests that want to load/clear test Record data.'''
22 app_module = main.app 22 app_module = main.app
23 23
24 def add_record(self, hours_from_start, tagged_fields): 24 def add_record(self, hours_from_start, tagged_fields):
25 tagged_fields.setdefault('project', 'test') 25 tagged_fields.setdefault('project', 'test')
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 def get_stats(name): 84 def get_stats(name):
85 cq_stats = CQStats.query(CQStats.begin == stats_start).get() 85 cq_stats = CQStats.query(CQStats.begin == stats_start).get()
86 for stats in cq_stats.count_stats + cq_stats.list_stats: 86 for stats in cq_stats.count_stats + cq_stats.list_stats:
87 if stats.name == name: 87 if stats.name == name:
88 return stats 88 return stats
89 return None 89 return None
90 90
91 def hours(n): # pragma: no cover 91 def hours(n): # pragma: no cover
92 '''Convert hours to seconds.''' 92 '''Convert hours to seconds.'''
93 return n * 60 * 60 93 return n * 60 * 60
OLDNEW
« no previous file with comments | « appengine/chromium_cq_status/shared/utils.py ('k') | appengine/chromium_cq_status/templates/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698