Index: Tools/TestResultServer/handlers/testfilehandler_test.py |
diff --git a/Tools/TestResultServer/handlers/testfilehandler_test.py b/Tools/TestResultServer/handlers/testfilehandler_test.py |
index 2cc2b591e59e9685ba616cb08b9590011a906c6c..15fb6e7c113fe5330441d68ce1eef54d3b31e68d 100755 |
--- a/Tools/TestResultServer/handlers/testfilehandler_test.py |
+++ b/Tools/TestResultServer/handlers/testfilehandler_test.py |
@@ -62,6 +62,52 @@ class TestFileHandlerTest(unittest.TestCase): |
def tearDown(self): |
self.tb.deactivate() |
+ def test_basic_upload(self): |
+ master = master_config.getMaster('chromium.chromiumos') |
+ builder = 'test-builder' |
+ test_type = 'test-type' |
+ test_data = { |
+ 'tests': { |
+ 'Test1.testproc1': { |
+ 'expected': 'PASS', |
+ 'actual': 'PASS', |
+ 'time': 1, |
+ } |
+ }, |
+ 'build_number': '123', |
+ 'version': JSON_RESULTS_HIERARCHICAL_VERSION, |
+ 'builder_name': builder, |
+ 'blink_revision': '12345', |
+ 'seconds_since_epoch': 1406123456, |
+ 'num_failures_by_type': { |
+ 'FAIL': 0, |
+ 'SKIP': 0, |
+ 'PASS': 1 |
+ }, |
+ 'chromium_revision': '67890', |
+ } |
+ |
+ params = collections.OrderedDict([ |
+ (testfilehandler.PARAM_BUILDER, builder), |
+ (testfilehandler.PARAM_MASTER, master['url_name']), |
+ (testfilehandler.PARAM_TEST_TYPE, test_type), |
+ ]) |
+ upload_files = [('file', 'full_results.json', json.JSONEncoder().encode(test_data))] |
+ response = self.testapp.post('/testfile/upload', params=params, upload_files=upload_files) |
+ self.assertEqual(response.status_int, 200) |
+ |
+ params = collections.OrderedDict([ |
+ (testfilehandler.PARAM_BUILDER, builder), |
+ (testfilehandler.PARAM_MASTER, master['url_name']), |
+ (testfilehandler.PARAM_TEST_TYPE, test_type), |
+ (testfilehandler.PARAM_BUILD_NUMBER, '123'), |
+ (testfilehandler.PARAM_NAME, 'full_results.json') |
+ ]) |
+ response = self.testapp.get('/testfile', params=params) |
+ self.assertEqual(response.status_int, 200) |
+ response_json = json.loads(response.normal_body) |
+ self.assertEqual(response_json['chromium_revision'], '67890') |
+ |
def test_deprecated_master_name(self): |
"""Verify that a file uploaded with a deprecated master name |
can be downloaded by the corresponding new-style master name. |