| OLD | NEW |
| 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 import collections | 5 import collections |
| 6 import json | 6 import json |
| 7 import os |
| 7 | 8 |
| 8 from appengine.utils import testing | 9 from appengine.utils import testing |
| 9 from appengine.test_results import main | 10 |
| 10 from appengine.test_results.handlers import master_config | 11 from appengine.path_mangler_hack import PathMangler |
| 11 from appengine.test_results.handlers import testfilehandler | 12 with PathMangler(os.path.dirname(os.path.dirname(__file__))): |
| 12 from appengine.test_results.model.jsonresults import ( | 13 from appengine.test_results import main |
| 13 JSON_RESULTS_HIERARCHICAL_VERSION | 14 from appengine.test_results.handlers import master_config |
| 14 ) | 15 from appengine.test_results.handlers import testfilehandler |
| 16 from appengine.test_results.model.jsonresults import ( |
| 17 JSON_RESULTS_HIERARCHICAL_VERSION |
| 18 ) |
| 15 | 19 |
| 16 | 20 |
| 17 class TestFileHandlerTest(testing.AppengineTestCase): | 21 class TestFileHandlerTest(testing.AppengineTestCase): |
| 18 | 22 |
| 19 app_module = main.app | 23 app_module = main.app |
| 20 | 24 |
| 21 def test_basic_upload(self): | 25 def test_basic_upload(self): |
| 22 master = master_config.getMaster('chromium.chromiumos') | 26 master = master_config.getMaster('chromium.chromiumos') |
| 23 builder = 'test-builder' | 27 builder = 'test-builder' |
| 24 test_type = 'test-type' | 28 test_type = 'test-type' |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 (testfilehandler.PARAM_BUILDER, builder), | 153 (testfilehandler.PARAM_BUILDER, builder), |
| 150 (testfilehandler.PARAM_MASTER, master['url_name']), | 154 (testfilehandler.PARAM_MASTER, master['url_name']), |
| 151 (testfilehandler.PARAM_TEST_TYPE, test_type), | 155 (testfilehandler.PARAM_TEST_TYPE, test_type), |
| 152 (testfilehandler.PARAM_BUILD_NUMBER, '123'), | 156 (testfilehandler.PARAM_BUILD_NUMBER, '123'), |
| 153 (testfilehandler.PARAM_NAME, 'full_results.json') | 157 (testfilehandler.PARAM_NAME, 'full_results.json') |
| 154 ]) | 158 ]) |
| 155 response = self.test_app.get('/testfile', params=params) | 159 response = self.test_app.get('/testfile', params=params) |
| 156 self.assertEqual(response.status_int, 200) | 160 self.assertEqual(response.status_int, 200) |
| 157 response_json = json.loads(response.normal_body) | 161 response_json = json.loads(response.normal_body) |
| 158 self.assertEqual(response_json['chromium_revision'], '67890') | 162 self.assertEqual(response_json['chromium_revision'], '67890') |
| OLD | NEW |