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

Side by Side Diff: appengine/chromium_cq_status/model/record.py

Issue 515093004: chromium-cq-status: StatsTest utility class for testing CQ stats (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 6 years, 3 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 shared.utils import to_unix_timestamp
6
5 from google.appengine.ext import ndb 7 from google.appengine.ext import ndb
6 8
7 class Record(ndb.Model): 9 class Record(ndb.Model): # pragma: no cover
8 timestamp = ndb.DateTimeProperty(auto_now=True) 10 timestamp = ndb.DateTimeProperty(auto_now=True)
9 tags = ndb.StringProperty(repeated=True) 11 tags = ndb.StringProperty(repeated=True)
10 fields = ndb.JsonProperty(default={}) 12 fields = ndb.JsonProperty(default={})
13
14 def to_dict(self):
15 return {
16 'key': self.key.id() if type(self.key.id()) != long else None,
17 'timestamp': to_unix_timestamp(self.timestamp),
18 'tags': self.tags,
19 'fields': self.fields,
20 }
OLDNEW
« no previous file with comments | « appengine/chromium_cq_status/handlers/query.py ('k') | appengine/chromium_cq_status/tests/resources/test_load_records.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698