File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 11import re
22from hashlib import md5
3+ from urllib .parse import quote
34
45import typing_extensions
56
@@ -95,7 +96,7 @@ def get_user(self):
9596 return self ._get ("/user" )
9697
9798 def search (self , term : str ):
98- path = f"/pages/search-page-results?search_term={ term } "
99+ path = f"/pages/search-page-results?search_term={ quote ( term ) } "
99100 raw_results = self ._get (path , add_picnic_headers = True )
100101 return _extract_search_results (raw_results )
101102
Original file line number Diff line number Diff line change @@ -98,6 +98,14 @@ def test_search(self):
9898 headers = PICNIC_HEADERS ,
9999 )
100100
101+ def test_search_encoding (self ):
102+ self .client .search ("Gut&Günstig H-Milch" )
103+ self .session_mock ().get .assert_called_with (
104+ self .expected_base_url
105+ + "/pages/search-page-results?search_term=Gut%26G%C3%BCnstig%20H-Milch" ,
106+ headers = PICNIC_HEADERS ,
107+ )
108+
101109 def test_get_cart (self ):
102110 self .client .get_cart ()
103111 self .session_mock ().get .assert_called_with (
You can’t perform that action at this time.
0 commit comments