@@ -16,7 +16,8 @@ def setup_with_client_id(self, set_api_key_and_client_id):
1616 self .provider = ConnectionType .GoogleOAuth
1717 self .customer_domain = "workos.com"
1818 self .redirect_uri = "https://localhost/auth/callback"
19- self .state = json .dumps ({"things" : "with_stuff" ,})
19+ self .state = json .dumps ({"things" : "with_stuff" })
20+ self .connection = "connection_123"
2021
2122 self .sso = SSO ()
2223
@@ -25,7 +26,7 @@ def setup_with_project_id(self, set_api_key_and_project_id):
2526 self .provider = ConnectionType .GoogleOAuth
2627 self .customer_domain = "workos.com"
2728 self .redirect_uri = "https://localhost/auth/callback"
28- self .state = json .dumps ({"things" : "with_stuff" , })
29+ self .state = json .dumps ({"things" : "with_stuff" })
2930
3031 self .sso = SSO ()
3132
@@ -99,7 +100,7 @@ def mock_connections(self):
99100 "listMetadata" : {"before" : None , "after" : None },
100101 }
101102
102- def test_authorization_url_throws_value_error_with_missing_domain_and_provider (
103+ def test_authorization_url_throws_value_error_with_missing_connection_domain_and_provider (
103104 self , setup_with_client_id
104105 ):
105106 with pytest .raises (ValueError , match = r"Incomplete arguments.*" ):
@@ -153,6 +154,25 @@ def test_authorization_url_has_expected_query_params_with_domain(
153154 "state" : self .state ,
154155 }
155156
157+ def test_authorization_url_has_expected_query_params_with_connection (
158+ self , setup_with_client_id
159+ ):
160+ authorization_url = self .sso .get_authorization_url (
161+ connection = self .connection ,
162+ redirect_uri = self .redirect_uri ,
163+ state = self .state ,
164+ )
165+
166+ parsed_url = urlparse (authorization_url )
167+
168+ assert dict (parse_qsl (parsed_url .query )) == {
169+ "connection" : self .connection ,
170+ "client_id" : workos .client_id ,
171+ "redirect_uri" : self .redirect_uri ,
172+ "response_type" : RESPONSE_TYPE_CODE ,
173+ "state" : self .state ,
174+ }
175+
156176 def test_authorization_url_has_expected_query_params_with_domain_and_provider (
157177 self , setup_with_client_id
158178 ):
0 commit comments