@@ -37,6 +37,29 @@ def test_build_query(self):
3737 "scope" : "email calendar" ,
3838 }
3939
40+ def test_build_query_with_smtp_required_true (self ):
41+ config = {
42+ "foo" : "bar" ,
43+ "scope" : ["email" ],
44+ "smtp_required" : True ,
45+ }
46+ result = _build_query (config )
47+ assert result ["options" ] == "smtp_required"
48+
49+ def test_build_query_smtp_required_false_omits_options (self ):
50+ config = {
51+ "foo" : "bar" ,
52+ "scope" : ["email" ],
53+ "smtp_required" : False ,
54+ }
55+ result = _build_query (config )
56+ assert "options" not in result
57+
58+ def test_build_query_smtp_required_omitted_omits_options (self ):
59+ config = {"foo" : "bar" , "scope" : ["email" ]}
60+ result = _build_query (config )
61+ assert "options" not in result
62+
4063 def test_build_query_with_pkce (self ):
4164 config = {
4265 "foo" : "bar" ,
@@ -52,6 +75,17 @@ def test_build_query_with_pkce(self):
5275 "code_challenge_method" : "s256" ,
5376 }
5477
78+ def test_build_query_with_pkce_and_smtp_required (self ):
79+ config = {
80+ "foo" : "bar" ,
81+ "scope" : ["email" ],
82+ "smtp_required" : True ,
83+ }
84+ result = _build_query_with_pkce (config , "secret-hash-123" )
85+ assert result ["options" ] == "smtp_required"
86+ assert result ["code_challenge" ] == "secret-hash-123"
87+ assert result ["code_challenge_method" ] == "s256"
88+
5589 def test_build_query_with_admin_consent (self ):
5690 config = {
5791 "foo" : "bar" ,
0 commit comments