@@ -82,9 +82,9 @@ class TestMalformed:
8282
8383 @pytest .mark .parametrize (
8484 'authorization_string' ,
85- ['gibberish' , 'VWS' , 'VWS ' ],
85+ ['gibberish' , 'VWS' ],
8686 )
87- def test_one_part (
87+ def test_one_part_no_space (
8888 self ,
8989 endpoint : Endpoint ,
9090 authorization_string : str ,
@@ -126,6 +126,45 @@ def test_one_part(
126126 result_code = ResultCodes .FAIL ,
127127 )
128128
129+ def test_one_part_with_space (self , endpoint : Endpoint ) -> None :
130+ """
131+ A valid authorization string is two "parts" when split on a space. When
132+ a string is given which is one "part", a ``BAD_REQUEST`` or
133+ ``UNAUTHORIZED`` response is returned.
134+ """
135+ authorization_string = 'VWS '
136+ date = rfc_1123_date ()
137+
138+ headers : Dict [str , str ] = {
139+ ** endpoint .prepared_request .headers ,
140+ 'Authorization' : authorization_string ,
141+ 'Date' : date ,
142+ }
143+
144+ endpoint .prepared_request .headers = CaseInsensitiveDict (data = headers )
145+ session = requests .Session ()
146+ response = session .send (request = endpoint .prepared_request )
147+
148+ url = str (endpoint .prepared_request .url )
149+ netloc = urlparse (url ).netloc
150+ if netloc == 'cloudreco.vuforia.com' :
151+ assert_vwq_failure (
152+ response = response ,
153+ status_code = HTTPStatus .UNAUTHORIZED ,
154+ content_type = 'text/plain;charset=iso-8859-1' ,
155+ cache_control = None ,
156+ www_authenticate = 'VWS' ,
157+ connection = 'keep-alive' ,
158+ )
159+ assert response .text == 'Malformed authorization header.'
160+ return
161+
162+ assert_vws_failure (
163+ response = response ,
164+ status_code = HTTPStatus .BAD_REQUEST ,
165+ result_code = ResultCodes .FAIL ,
166+ )
167+
129168 @pytest .mark .parametrize (
130169 'authorization_string' ,
131170 [
0 commit comments