@@ -638,7 +638,7 @@ def test_response_bad_content_type(sync_client):
638638
639639
640640def test_search_request (httpserver , sync_client ):
641- query_string = "attributes=userName&attributes=displayName &filter=userName+Eq+%22john%22&sortBy=userName&sortOrder=ascending&startIndex=1&count=10"
641+ query_string = "attributes=userName%2CdisplayName &filter=userName+Eq+%22john%22&sortBy=userName&sortOrder=ascending&startIndex=1&count=10"
642642
643643 httpserver .expect_request (
644644 "/Users/with-qs" , query_string = query_string
@@ -673,7 +673,7 @@ def test_search_request(httpserver, sync_client):
673673
674674def test_query_parameters (httpserver , sync_client ):
675675 """ResponseParameters can be used instead of SearchRequest for single-resource queries."""
676- query_string = "attributes=userName&attributes=displayName "
676+ query_string = "attributes=userName%2CdisplayName "
677677
678678 httpserver .expect_request (
679679 "/Users/with-rp" , query_string = query_string
@@ -698,6 +698,23 @@ def test_query_parameters(httpserver, sync_client):
698698 assert response .id == "with-rp"
699699
700700
701+ def test_query_empty_list_parameters_are_not_sent (httpserver , sync_client ):
702+ """Empty attribute lists are left out of the query string."""
703+ httpserver .expect_request (
704+ "/Users/with-empty" , query_string = "attributes=userName"
705+ ).respond_with_json (
706+ {
707+ "schemas" : ["urn:ietf:params:scim:schemas:core:2.0:User" ],
708+ "id" : "with-empty" ,
709+ "userName" : "bjensen@example.com" ,
710+ },
711+ status = 200 ,
712+ )
713+ params = ResponseParameters (attributes = ["userName" ], excluded_attributes = [])
714+ response = sync_client .query (User , "with-empty" , params )
715+ assert response .id == "with-empty"
716+
717+
701718def test_query_parameters_dict (httpserver , sync_client ):
702719 """Query parameters given as a dict are sent to the server."""
703720 sync_client .query (
@@ -752,8 +769,11 @@ def test_invalid_query_parameters_dict(sync_client):
752769
753770
754771def test_query_dont_check_request_payload (httpserver , sync_client ):
755- """Raw dict payloads are forwarded as-is when check_request_payload is False."""
756- query_string = "attributes=userName&attributes=displayName&excluded_attributes=timezone&excluded_attributes=phoneNumbers&filter=userName+Eq+%22john%22&sort_by=userName&sort_order=ascending&start_index=1&count=10"
772+ """Raw dict payloads are forwarded unvalidated when check_request_payload is False.
773+
774+ List values are sent as comma-separated values.
775+ """
776+ query_string = "attributes=userName%2CdisplayName&excluded_attributes=timezone%2CphoneNumbers&filter=userName+Eq+%22john%22&sort_by=userName&sort_order=ascending&start_index=1&count=10"
757777
758778 httpserver .expect_request (
759779 "/Users/with-qs" , query_string = query_string
0 commit comments