def test_analyse_cer(self): re_map = { '1.1.1.1': { 'subject': 'CN=TrustedRoot,C=US,ST=MA,L=Hopkinton,' '[email protected],OU=CSP,O=RSA', 'issuer': '1.1.1.1', 'serial#': '00d8280b0c863f6d4e', 'valid_from': '20090407135111Z', 'valid_to': '20190405135111Z' } } navi_handler = NaviHandler(**ACCESS_INFO) cer_map = navi_handler.analyse_cer(CER_INFOS, host_ip='1.1.1.1') self.assertDictEqual(cer_map, re_map)
def test_analyse_cer_exception(self): with self.assertRaises(Exception) as exc: navi_handler = NaviHandler(**ACCESS_INFO) navi_handler.analyse_cer(CER_INFOS) self.assertIn('arrange cer info error', str(exc.exception))