Skip to content

Commit

Permalink
[tst] additional unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
grindsa committed Oct 26, 2024
1 parent 2ae0119 commit e1536fa
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/ca_handler/mscertsrv_ca_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def enroll(self, csr: str) -> Tuple[str, str, str, bool]:
result = self._domainlist_check(csr)

if result:

# check for eab profiling and header_info
error = eab_profile_header_info_check(self.logger, self, csr, 'template')

Expand Down
28 changes: 28 additions & 0 deletions test/test_msca_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,34 @@ def test_058_config_headerinfo_load(self):
self.assertFalse(self.cahandler.header_info_field)
self.assertIn('WARNING:test_a2c:Order._config_orderconfig_load() header_info_list failed with error: Expecting value: line 1 column 1 (char 0)', lcm.output)

def test_059__config_url_load(self):
""" test _config_url_load()"""
config_dic = {'CAhandler': {'url': 'foo'}}
self.cahandler._config_url_load(config_dic)
self.assertEqual( 'foo', self.cahandler.url)

@patch.dict('os.environ', {'url_variable': 'foo1'})
def test_060__config_url_load(self):
""" test _config_url_load()"""
config_dic = {'CAhandler': {'url_variable': 'url_variable'}}
self.cahandler._config_url_load(config_dic)
self.assertEqual( 'foo1', self.cahandler.url)

@patch.dict('os.environ', {'url_variable': 'foo1'})
def test_061__config_url_load(self):
""" test _config_url_load()"""
config_dic = {'CAhandler': {'url_variable': 'url_variable', 'url': 'foo'}}
self.cahandler._config_url_load(config_dic)
self.assertEqual( 'foo', self.cahandler.url)

@patch.dict('os.environ', {'url_variable': 'foo1'})
def test_062__config_url_load(self):
""" test _config_url_load()"""
config_dic = {'CAhandler': {'url_variable': 'doesnotexist'}}
with self.assertLogs('test_a2c', level='INFO') as lcm:
self.cahandler._config_url_load(config_dic)
self.assertFalse(self.cahandler.url)
self.assertIn("ERROR:test_a2c:CAhandler._config_load() could not load url_variable:'doesnotexist'", lcm.output)

if __name__ == '__main__':

Expand Down

0 comments on commit e1536fa

Please sign in to comment.