Browse Source

(tests) Stronger assertions

main
Michal Charemza 5 years ago
parent
commit
d3b14ebdad
No known key found for this signature in database GPG Key ID: 4BBAF0F6B73C4363
1 changed files with 9 additions and 3 deletions
  1. +9
    -3
      test.py

+ 9
- 3
test.py View File

@@ -35,9 +35,11 @@ class TestProxy(unittest.TestCase):
stop = await start()
self.add_async_cleanup(stop)

with self.assertRaises(DnsResponseCode):
with self.assertRaises(DnsResponseCode) as cm:
await resolve('www.google.com', TYPES.A)

self.assertEqual(cm.exception.args[0], 5)

@async_test
async def test_e2e_match_all(self):
resolve, clear_cache = get_resolver(3535)
@@ -82,9 +84,11 @@ class TestProxy(unittest.TestCase):
stop = await start()
self.add_async_cleanup(stop)

with self.assertRaises(DnsResponseCode):
with self.assertRaises(DnsResponseCode) as cm:
await resolve('www.google.com', TYPES.A)

self.assertEqual(cm.exception.args[0], 2)

@async_test
async def test_e2e_default_resolver_match_none_non_existing_domain(self):
resolve, clear_cache = get_resolver(53)
@@ -93,9 +97,11 @@ class TestProxy(unittest.TestCase):
stop = await start()
self.add_async_cleanup(stop)

with self.assertRaises(DnsResponseCode):
with self.assertRaises(DnsResponseCode) as cm:
await resolve('doesnotexist.charemza.name', TYPES.A)

self.assertEqual(cm.exception.args[0], 5)


def get_socket(port):
def _get_socket():


Loading…
Cancel
Save