def test_serviceping_scan_open_https_url(self): result = scan( 'yahoo.com', port=443, https=True, url='https://yahoo.com/' ) self.assertEqual(result['state'], 'open') self.assertEqual(result['host'], 'yahoo.com') self.assertEqual(result['port'], 443) self.assertIn(result['code'], [200, 301])
def test_serviceping_scan_open_https(self): result = scan('yahoo.com', port=443, https=True) self.assertEqual(result['state'], 'open') self.assertEqual(result['host'], 'yahoo.com') self.assertEqual(result['port'], 443)
def test_serviceping_scan_open_http(self): result = scan('yahoo.com', port=80) self.assertEqual(result['state'], 'open') self.assertEqual(result['host'], 'yahoo.com') self.assertEqual(result['port'], 80)
def test_serviceping_scan_closed(self): result = scan('localhost', port=65500) self.assertEqual(result['state'], 'closed') self.assertEqual(result['host'], 'localhost') self.assertEqual(result['port'], 65500)
def test_serviceping_scan_no_max_size(self): result = scan('localhost', port=65500, max_size=None) self.assertEqual(result['state'], 'closed') self.assertEqual(result['host'], 'localhost') self.assertEqual(result['port'], 65500)
def test_serviceping_scan_invalid_hostname(self): with self.assertRaises(ScanFailed): scan('pythonpython.python')