2222
2323jurisdiction = "illinois" # 'massachusetts'
2424
25- base_url = None # From Env var
26- api_key = None # From Env var
25+ base_url = os . getenv ( "PROXY_URL" )
26+ api_key = os . getenv ( "PROXY_API_KEY" )
2727
2828
2929def mock_person ():
@@ -49,6 +49,9 @@ def mock_person():
4949class BadAuth (unittest .TestCase ):
5050
5151 def test_misconfigured_proxy (self ):
52+ if not base_url :
53+ print ("Need to pass the Proxy Server URL" )
54+ exit (1 )
5255 bad_proxy = EfspConnection (
5356 url = base_url ,
5457 api_key = "IntenionallyWrongKey" ,
@@ -58,6 +61,17 @@ def test_misconfigured_proxy(self):
5861 self .assertEqual (intentional_bad_resp .response_code , 403 )
5962 bad_proxy .proxy_client .close ()
6063
64+ def test_good_but_no_password_proxy (self ):
65+ good_proxy = EfspConnection (
66+ url = base_url ,
67+ api_key = api_key ,
68+ default_jurisdiction = jurisdiction ,
69+ )
70+
71+ empty_resp = good_proxy .authenticate_user ()
72+ self .assertTrue (empty_resp .is_ok ())
73+ self .assertEqual (empty_resp .data ["tokens" ], {})
74+
6175
6276class TestClass (unittest .TestCase ):
6377
@@ -74,14 +88,16 @@ def setUp(self):
7488 # Actual setup
7589 self .user_email = os .getenv ("TYLER_USER_EMAIL" )
7690 self .user_password = os .getenv ("TYLER_USER_PASSWORD" )
77- api_key = os .getenv ("PROXY_API_KEY" )
91+ if not base_url :
92+ print ("Need to pass the Proxy Server URL" )
93+ exit (1 )
7894 if not api_key :
7995 print ("You need to have the PROXY_API_KEY env var set; not running tests" )
8096 exit (2 )
8197 self .proxy_conn = EfspConnection (
8298 url = base_url , api_key = api_key , default_jurisdiction = jurisdiction
8399 )
84- self .proxy_conn .set_verbose_logging (verbose )
100+ self .proxy_conn .set_verbose_logging (self . verbose )
85101 self .setup_authenticate ()
86102
87103 def tearDown (self ):
@@ -95,9 +111,6 @@ def basic_assert(self, resp: ApiResponse):
95111
96112 def setup_authenticate (self ):
97113 print ("\n \n ### Authenticate ###\n \n " )
98- empty_resp = self .proxy_conn .authenticate_user ()
99- self .basic_assert (empty_resp )
100- self .assertEqual (empty_resp .data ["tokens" ], [])
101114 resp = self .proxy_conn .authenticate_user (
102115 tyler_email = self .user_email , tyler_password = self .user_password
103116 )
@@ -233,7 +246,7 @@ def test_service_contacts(self):
233246 )
234247
235248 my_list = self .basic_assert (self .proxy_conn .get_service_contact_list ())
236- self .assertGreaterThan (len (my_list .data ), 1 )
249+ self .assertGreater (len (my_list .data ), 1 )
237250 updated_contact = self .basic_assert (
238251 self .proxy_conn .get_service_contact (contact_id )
239252 )
@@ -519,8 +532,4 @@ def test_logs(self):
519532
520533
521534if __name__ == "__main__" :
522- base_url = os .getenv ("PROXY_URL" )
523- if not base_url :
524- print ("Need to pass the Proxy Server URL" )
525- exit (1 )
526535 unittest .main ()
0 commit comments