Skip to content

Commit a64c55b

Browse files
author
KP
committed
#28822 ensure we don't try and sort by pivot_column fields by accident
pivot_column fields aren't sortable so in the case where we're sorting by an arbitrary field, ensure it's not a pivot_column. Iterate though the field list until we reach one that works.
1 parent d6d3943 commit a64c55b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/test_api_long.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,15 @@ def test_automated_find(self):
2828
continue
2929

3030
# trying to use some different code paths to the other find test
31+
# pivot_column fields aren't valid for sorting so ensure we're
32+
# not using one.
33+
order_field = None
34+
for field_name, field in fields.iteritems():
35+
if field['data_type']["value"] != 'pivot_column':
36+
order_field = field_name
37+
break
3138
# TODO for our test project, we haven't populated these entities....
32-
order = [{'field_name': fields.keys()[0], 'direction': direction}]
39+
order = [{'field_name': order_field, 'direction': direction}]
3340
if "project" in fields:
3441
filters = [['project', 'is', self.project]]
3542
else:

0 commit comments

Comments
 (0)