@@ -389,9 +389,9 @@ def test_query_string_manager(person_schema):
389
389
qsm = QSManager (query_string , person_schema )
390
390
with pytest .raises (BadRequest ):
391
391
qsm .pagination
392
- qsm .qs ['sort' ] = 'computers'
393
- with pytest .raises (InvalidSort ):
394
- qsm .sorting
392
+ # qsm.qs['sort'] = 'computers'
393
+ # with pytest.raises(InvalidSort):
394
+ # qsm.sorting
395
395
396
396
397
397
def test_resource (app , person_model , person_schema , session , monkeypatch ):
@@ -474,6 +474,46 @@ def test_get_list(client, register_routes, person, person_2):
474
474
response = client .get ('/persons' + '?' + querystring , content_type = 'application/vnd.api+json' )
475
475
assert response .status_code == 200
476
476
477
+ def test_get_list_sort_relationship (client , register_routes , person , person_2 ):
478
+ with client :
479
+ querystring = urlencode ({'page[number]' : 1 ,
480
+ 'page[size]' : 1 ,
481
+ 'fields[person]' : 'name,birth_date' ,
482
+ 'sort' : '-computers' ,
483
+ 'include' : 'computers.owner' ,
484
+ 'filter' : json .dumps (
485
+ [
486
+ {
487
+ 'and' : [
488
+ {
489
+ 'name' : 'computers' ,
490
+ 'op' : 'any' ,
491
+ 'val' : {
492
+ 'name' : 'serial' ,
493
+ 'op' : 'eq' ,
494
+ 'val' : '0000'
495
+ }
496
+ },
497
+ {
498
+ 'or' : [
499
+ {
500
+ 'name' : 'name' ,
501
+ 'op' : 'like' ,
502
+ 'val' : '%test%'
503
+ },
504
+ {
505
+ 'name' : 'name' ,
506
+ 'op' : 'like' ,
507
+ 'val' : '%test2%'
508
+ }
509
+ ]
510
+ }
511
+ ]
512
+ }
513
+ ])})
514
+ response = client .get ('/persons' + '?' + querystring , content_type = 'application/vnd.api+json' )
515
+ assert response .status_code == 200
516
+
477
517
478
518
def test_get_list_disable_pagination (client , register_routes ):
479
519
with client :
0 commit comments