mirror of
https://github.com/netzbegruenung/green-spider.git
synced 2024-05-01 08:34:51 +02:00
Add test for dns_resolution
This commit is contained in:
parent
764a4647c8
commit
f6edfd2ce6
23
checks/dns_resolution_test.py
Normal file
23
checks/dns_resolution_test.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
import unittest
|
||||
from pprint import pprint
|
||||
|
||||
from checks import dns_resolution
|
||||
from checks.config import Config
|
||||
|
||||
class TestDNSResolution(unittest.TestCase):
|
||||
|
||||
def test_google(self):
|
||||
"""Resolves www.google.com"""
|
||||
url = 'https://www.google.com/'
|
||||
config = Config(urls=[url])
|
||||
checker = dns_resolution.Checker(config=config, previous_results={})
|
||||
result = checker.run()
|
||||
|
||||
self.assertIn(url, result)
|
||||
self.assertEqual(result[url]['hostname'], 'www.google.com')
|
||||
self.assertTrue(result[url], 'resolvable')
|
||||
self.assertIsInstance(result[url]['ipv4_addresses'], list)
|
||||
self.assertNotEqual(result[url]['ipv4_addresses'], [])
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Loading…
Reference in a new issue