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

Unified Diff: gm/rebaseline_server/imagepairset_test.py

Issue 376623002: rebaseline_server: allow JSON to control column filtering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Ravi suggestions Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/rebaseline_server/imagepairset.py ('k') | gm/rebaseline_server/results.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/rebaseline_server/imagepairset_test.py
diff --git a/gm/rebaseline_server/imagepairset_test.py b/gm/rebaseline_server/imagepairset_test.py
index c2f17ba01a19312e94af2b4d39aa7a402cef89e1..5e17faa2f13008b73644be22a6e783069684b337 100755
--- a/gm/rebaseline_server/imagepairset_test.py
+++ b/gm/rebaseline_server/imagepairset_test.py
@@ -89,6 +89,7 @@ class ImagePairSetTest(unittest.TestCase):
'headerText': 'builder',
'isFilterable': True,
'isSortable': True,
+ 'useFreeformFilter': False,
'valuesAndCounts': [('MyBuilder', 3)],
},
'test': {
@@ -96,8 +97,13 @@ class ImagePairSetTest(unittest.TestCase):
'headerUrl': 'http://learn/about/gm/tests',
'isFilterable': True,
'isSortable': False,
+ 'useFreeformFilter': False,
+ 'valuesAndCounts': [('test1', 1),
+ ('test2', 1),
+ ('test3', 1)],
},
},
+ 'extraColumnOrder': ['builder', 'test'],
'imagePairs': [
IMAGEPAIR_1_AS_DICT,
IMAGEPAIR_2_AS_DICT,
@@ -136,8 +142,7 @@ class ImagePairSetTest(unittest.TestCase):
header_text='which GM test',
header_url='http://learn/about/gm/tests',
is_filterable=True,
- is_sortable=False,
- include_values_and_counts=False))
+ is_sortable=False))
self.assertEqual(image_pair_set.as_dict(), expected_imageset_dict)
def test_mismatched_base_url(self):
@@ -153,6 +158,23 @@ class ImagePairSetTest(unittest.TestCase):
MockImagePair(base_url=BASE_URL_2,
dict_to_return=IMAGEPAIR_3_AS_DICT))
+ def test_missing_column_ids(self):
+ """Confirms that passing truncated column_ids_in_order to as_dict()
+ will cause an exception."""
+ image_pair_set = imagepairset.ImagePairSet(
+ diff_base_url=DIFF_BASE_URL)
+ image_pair_set.add_image_pair(
+ MockImagePair(base_url=BASE_URL_1, dict_to_return=IMAGEPAIR_1_AS_DICT))
+ image_pair_set.add_image_pair(
+ MockImagePair(base_url=BASE_URL_1, dict_to_return=IMAGEPAIR_2_AS_DICT))
+ # Call as_dict() with default or reasonable column_ids_in_order.
+ image_pair_set.as_dict()
+ image_pair_set.as_dict(column_ids_in_order=['test', 'builder'])
+ image_pair_set.as_dict(column_ids_in_order=['test', 'builder', 'extra'])
+ # Call as_dict() with not enough column_ids.
+ with self.assertRaises(Exception):
+ image_pair_set.as_dict(column_ids_in_order=['builder'])
+
class MockImagePair(object):
"""Mock ImagePair object, which will return canned results."""
« no previous file with comments | « gm/rebaseline_server/imagepairset.py ('k') | gm/rebaseline_server/results.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698