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

Side by Side Diff: dashboard/dashboard/graph_json_test.py

Issue 1549583002: In /graph_json, check internal_only on Test entity and skip test for all Row entities. (Closed) Base URL: https://github.com/catapult-project/catapult@master
Patch Set: Removed purposeful fail for local debugging Created 4 years, 12 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 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 import json 5 import json
6 import unittest 6 import unittest
7 7
8 import mock 8 import mock
9 import webapp2 9 import webapp2
10 import webtest 10 import webtest
11 11
12 from google.appengine.ext import ndb 12 from google.appengine.ext import ndb
13 13
14 from dashboard import graph_json 14 from dashboard import graph_json
15 from dashboard import testing_common 15 from dashboard import testing_common
16 from dashboard import utils 16 from dashboard import utils
17 from dashboard.models import anomaly 17 from dashboard.models import anomaly
18 from dashboard.models import graph_data 18 from dashboard.models import graph_data
19 19
20 20
21 class GraphJsonTest(testing_common.TestCase): 21 class GraphJsonTest(testing_common.TestCase):
22 22
23 def setUp(self): 23 def setUp(self):
24 super(GraphJsonTest, self).setUp() 24 super(GraphJsonTest, self).setUp()
25 app = webapp2.WSGIApplication( 25 app = webapp2.WSGIApplication(
26 [('/graph_json', graph_json.GraphJsonHandler)]) 26 [('/graph_json', graph_json.GraphJsonHandler)])
27 self.testapp = webtest.TestApp(app) 27 self.testapp = webtest.TestApp(app)
28 testing_common.SetInternalDomain('google.com') 28 testing_common.SetInternalDomain('google.com')
29 self.PatchDatastoreHooksRequest()
29 30
30 # TODO(qyearsley): graph_json_test is very slow (it takes 60+ seconds 31 # TODO(qyearsley): graph_json_test is very slow (it takes 60+ seconds
31 # to run sometimes), and I have a hypothesis that most of the time is 32 # to run sometimes), and I have a hypothesis that most of the time is
32 # spent in _AddTestColumns. Investigate this hypothesis and make changes 33 # spent in _AddTestColumns. Investigate this hypothesis and make changes
33 # accordingly. 34 # accordingly.
34 def _AddTestColumns(self, start_rev=15000, end_rev=16500, step=3): 35 def _AddTestColumns(self, start_rev=15000, end_rev=16500, step=3):
35 """Adds a bunch of test data to the mock datastore. 36 """Adds a bunch of test data to the mock datastore.
36 37
37 In particular, add Rows with revisions in the given range (but skipping 38 In particular, add Rows with revisions in the given range (but skipping
38 some numbers, so the revisions are non-contiguous) under the dromaeo/dom 39 some numbers, so the revisions are non-contiguous) under the dromaeo/dom
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 rows = testing_common.AddRows('Master/b/my_suite', [345]) 796 rows = testing_common.AddRows('Master/b/my_suite', [345])
796 # This row has no a_tracing_uri property, so there should be no 797 # This row has no a_tracing_uri property, so there should be no
797 # trace annotation returned by _PointInfoDict. 798 # trace annotation returned by _PointInfoDict.
798 point_info = graph_json._PointInfoDict(rows[0], test, {}) 799 point_info = graph_json._PointInfoDict(rows[0], test, {})
799 self.assertFalse(hasattr(rows[0], 'a_tracing_uri')) 800 self.assertFalse(hasattr(rows[0], 'a_tracing_uri'))
800 self.assertNotIn('a_tracing_uri', point_info) 801 self.assertNotIn('a_tracing_uri', point_info)
801 802
802 803
803 if __name__ == '__main__': 804 if __name__ == '__main__':
804 unittest.main() 805 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698