Allow multiple primary key fields to be specified for processing tests

`
This commit is contained in:
Nyall Dawson 2017-09-08 16:33:55 +10:00
parent c750cb2154
commit e9fd409552

View File

@ -105,7 +105,11 @@ class TestCase(_TestCase):
def sort_by_pk_or_fid(f):
if 'pk' in kwargs and kwargs['pk'] is not None:
return f[kwargs['pk']]
key = kwargs['pk']
if isinstance(key, list) or isinstance(key, tuple):
return [f[k] for k in key]
else:
return f[kwargs['pk']]
else:
return f.id()