OLD | NEW |
1 # Copyright (C) 2014 Google Inc. All rights reserved. | 1 # Copyright (C) 2014 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 import json | 29 import json |
30 import unittest | 30 import unittest |
31 | 31 |
32 from webkitpy.layout_tests.generate_results_dashboard import ProcessJsonData | 32 from webkitpy.layout_tests.generate_results_dashboard import ProcessJsonData |
33 | 33 |
34 | 34 |
35 class ProcessJsonDataTester(unittest.TestCase): | 35 class ProcessJsonDataTester(unittest.TestCase): |
36 | 36 |
37 def test_check_failing_results(self): | 37 def test_check_failing_results(self): |
38 valid_json_data = {u'tests': {u'test_category': {u'test_sub_category': {
u'test_name': {u'test.html': {u'expected': u'PASS', u'actual': u'TEXT', u'is_une
xpected': True}}}}}} | 38 valid_json_data = { |
39 valid_json_data_1 = {u'tests': {u'test_category': {u'test_sub_category':
{u'test_name': {u'test.html': {u'expected': u'TEXT', u'actual': u'TEXT', u'is_u
nexpected': True}}}}}} | 39 u'tests': { |
40 valid_json_data_2 = {u'tests': {u'test_category': {u'test_sub_category':
{u'test_name_2': {u'test_2.html': {u'expected': u'PASS', u'actual': u'TEXT', u'
is_unexpected': True}}, u'test_name': {u'test.html': {u'expected': u'TEXT', u'ac
tual': u'TEXT', u'is_unexpected': True}}}}}} | 40 u'test_category': { |
41 expected_result = {u'tests': {u'test_category': {u'test_sub_category': {
u'test_name': {u'test.html': {u'archived_results': [u'TEXT', u'PASS']}}}}}} | 41 u'test_sub_category': { |
| 42 u'test_name': { |
| 43 u'test.html': { |
| 44 u'expected': u'PASS', |
| 45 u'actual': u'TEXT', |
| 46 u'is_unexpected': True}}}}}} |
| 47 valid_json_data_1 = { |
| 48 u'tests': { |
| 49 u'test_category': { |
| 50 u'test_sub_category': { |
| 51 u'test_name': { |
| 52 u'test.html': { |
| 53 u'expected': u'TEXT', |
| 54 u'actual': u'TEXT', |
| 55 u'is_unexpected': True}}}}}} |
| 56 valid_json_data_2 = { |
| 57 u'tests': { |
| 58 u'test_category': { |
| 59 u'test_sub_category': { |
| 60 u'test_name_2': { |
| 61 u'test_2.html': { |
| 62 u'expected': u'PASS', |
| 63 u'actual': u'TEXT', |
| 64 u'is_unexpected': True}}, |
| 65 u'test_name': { |
| 66 u'test.html': { |
| 67 u'expected': u'TEXT', |
| 68 u'actual': u'TEXT', |
| 69 u'is_unexpected': True}}}}}} |
| 70 expected_result = { |
| 71 u'tests': { |
| 72 u'test_category': { |
| 73 u'test_sub_category': { |
| 74 u'test_name': { |
| 75 u'test.html': { |
| 76 u'archived_results': [ |
| 77 u'TEXT', |
| 78 u'PASS']}}}}}} |
42 process_json_data = ProcessJsonData(valid_json_data, [valid_json_data_1]
, [valid_json_data_2]) | 79 process_json_data = ProcessJsonData(valid_json_data, [valid_json_data_1]
, [valid_json_data_2]) |
43 actual_result = process_json_data.generate_archived_result() | 80 actual_result = process_json_data.generate_archived_result() |
44 self.assertEqual(expected_result, actual_result) | 81 self.assertEqual(expected_result, actual_result) |
45 | 82 |
46 def test_check_full_results(self): | 83 def test_check_full_results(self): |
47 valid_json_data = {u'tests': {u'test_category': {u'test_sub_category': {
u'test_name_2': {u'test_2.html': {u'expected': u'PASS', u'actual': u'TEXT', u'is
_unexpected': True}}}}}} | 84 valid_json_data = { |
48 valid_json_data_1 = {u'tests': {u'test_category': {u'test_sub_category':
{u'test_name': {u'test.html': {u'expected': u'TEXT', u'actual': u'TEXT', u'is_u
nexpected': True}}}}}} | 85 u'tests': { |
49 valid_json_data_2 = {u'tests': {u'test_category': {u'test_sub_category':
{u'test_name_2': {u'test_2.html': {u'expected': u'PASS', u'actual': u'TEXT', u'
is_unexpected': True}}, u'test_name': {u'test.html': {u'expected': u'TEXT', u'ac
tual': u'TEXT', u'is_unexpected': True}}}}}} | 86 u'test_category': { |
50 expected_result = {u'tests': {u'test_category': {u'test_sub_category': {
u'test_name_2': {u'test_2.html': {u'archived_results': [u'TEXT', u'TEXT']}}}}}} | 87 u'test_sub_category': { |
| 88 u'test_name_2': { |
| 89 u'test_2.html': { |
| 90 u'expected': u'PASS', |
| 91 u'actual': u'TEXT', |
| 92 u'is_unexpected': True}}}}}} |
| 93 valid_json_data_1 = { |
| 94 u'tests': { |
| 95 u'test_category': { |
| 96 u'test_sub_category': { |
| 97 u'test_name': { |
| 98 u'test.html': { |
| 99 u'expected': u'TEXT', |
| 100 u'actual': u'TEXT', |
| 101 u'is_unexpected': True}}}}}} |
| 102 valid_json_data_2 = { |
| 103 u'tests': { |
| 104 u'test_category': { |
| 105 u'test_sub_category': { |
| 106 u'test_name_2': { |
| 107 u'test_2.html': { |
| 108 u'expected': u'PASS', |
| 109 u'actual': u'TEXT', |
| 110 u'is_unexpected': True}}, |
| 111 u'test_name': { |
| 112 u'test.html': { |
| 113 u'expected': u'TEXT', |
| 114 u'actual': u'TEXT', |
| 115 u'is_unexpected': True}}}}}} |
| 116 expected_result = { |
| 117 u'tests': { |
| 118 u'test_category': { |
| 119 u'test_sub_category': { |
| 120 u'test_name_2': { |
| 121 u'test_2.html': { |
| 122 u'archived_results': [ |
| 123 u'TEXT', |
| 124 u'TEXT']}}}}}} |
51 process_json_data = ProcessJsonData(valid_json_data, [valid_json_data_1]
, [valid_json_data_2]) | 125 process_json_data = ProcessJsonData(valid_json_data, [valid_json_data_1]
, [valid_json_data_2]) |
52 actual_result = process_json_data.generate_archived_result() | 126 actual_result = process_json_data.generate_archived_result() |
53 self.assertEqual(expected_result, actual_result) | 127 self.assertEqual(expected_result, actual_result) |
54 | 128 |
55 def test_null_check(self): | 129 def test_null_check(self): |
56 valid_json_data = {u'tests': {u'test_category': {u'test_sub_category': {
u'test_name': {u'test.html': {u'expected': u'PASS', u'actual': u'TEXT', u'is_une
xpected': True}}}}}} | 130 valid_json_data = { |
57 expected_result = {u'tests': {u'test_category': {u'test_sub_category': {
u'test_name': {u'test.html': {u'archived_results': [u'TEXT']}}}}}} | 131 u'tests': { |
| 132 u'test_category': { |
| 133 u'test_sub_category': { |
| 134 u'test_name': { |
| 135 u'test.html': { |
| 136 u'expected': u'PASS', |
| 137 u'actual': u'TEXT', |
| 138 u'is_unexpected': True}}}}}} |
| 139 expected_result = { |
| 140 u'tests': { |
| 141 u'test_category': { |
| 142 u'test_sub_category': { |
| 143 u'test_name': { |
| 144 u'test.html': { |
| 145 u'archived_results': [u'TEXT']}}}}}} |
58 process_json_data = ProcessJsonData(valid_json_data, [], []) | 146 process_json_data = ProcessJsonData(valid_json_data, [], []) |
59 actual_result = process_json_data.generate_archived_result() | 147 actual_result = process_json_data.generate_archived_result() |
60 self.assertEqual(expected_result, actual_result) | 148 self.assertEqual(expected_result, actual_result) |
OLD | NEW |