Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dnsviz/dnsviz.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCasey Deccio <casey@deccio.net>2020-11-15 08:51:45 +0300
committerCasey Deccio <casey@deccio.net>2020-11-15 08:51:45 +0300
commit954bc1611a4c47bfe543b67642a35dd9d7f47226 (patch)
treef208749ff01f763385729e5ae994e93797f4d8d7 /tests
parent6e2f398bf9e002c90d37865f329e6b8771c6f481 (diff)
Update tests
Diffstat (limited to 'tests')
-rw-r--r--tests/dnsviz_probe_run_online.py35
1 files changed, 24 insertions, 11 deletions
diff --git a/tests/dnsviz_probe_run_online.py b/tests/dnsviz_probe_run_online.py
index 83e1038..8533d48 100644
--- a/tests/dnsviz_probe_run_online.py
+++ b/tests/dnsviz_probe_run_online.py
@@ -1,25 +1,38 @@
import io
+import os
import subprocess
+import tempfile
import unittest
-class DNSProbeTestCase(unittest.TestCase):
+class DNSVizProbeRunOnlineTestCase(unittest.TestCase):
def setUp(self):
- self.devnull = io.open('/dev/null', 'wb')
+ self.current_cwd = os.getcwd()
+ self.dnsviz_bin = os.path.join(self.current_cwd, 'bin', 'dnsviz')
+
+ self.output = tempfile.NamedTemporaryFile('wb', prefix='dnsviz', delete=False)
+ self.output.close()
def tearDown(self):
- self.devnull.close()
+ os.remove(self.output.name)
+
+ def test_dnsviz_probe_auth(self):
+ with io.open(self.output.name, 'wb') as fh:
+ self.assertEqual(subprocess.call([self.dnsviz_bin, 'probe', '-d', '0', '-A', '.'], stdout=fh), 0)
+
+ with io.open(self.output.name, 'wb') as fh:
+ self.assertEqual(subprocess.call([self.dnsviz_bin, 'probe', '-d', '0', '-A', 'example.com'], stdout=fh), 0)
- def test_authoritative_probe_root(self):
- self.assertEqual(subprocess.call(['./bin/dnsviz', 'probe', '-d', '0', '-A', '.'], stdout=self.devnull), 0)
+ def test_dnsviz_probe_rec(self):
+ with io.open(self.output.name, 'wb') as fh:
+ self.assertEqual(subprocess.call([self.dnsviz_bin, 'probe', '-d', '0', '.'], stdout=fh), 0)
- def test_authoritative_probe_example_com(self):
- self.assertEqual(subprocess.call(['./bin/dnsviz', 'probe', '-d', '0', '-A', 'example.com'], stdout=self.devnull), 0)
+ with io.open(self.output.name, 'wb') as fh:
+ self.assertEqual(subprocess.call([self.dnsviz_bin, 'probe', '-d', '0', 'example.com'], stdout=fh), 0)
- def test_recursive_probe_root(self):
- self.assertEqual(subprocess.call(['./bin/dnsviz', 'probe', '-d', '0', '.'], stdout=self.devnull), 0)
+ def test_dnsviz_probe_rec_multi(self):
+ with io.open(self.output.name, 'wb') as fh:
+ self.assertEqual(subprocess.call([self.dnsviz_bin, 'probe', '-d', '0', '-t', '3', '.', 'example.com', 'example.net'], stdout=fh), 0)
- def test_recursive_probe_example_com(self):
- self.assertEqual(subprocess.call(['./bin/dnsviz', 'probe', '-d', '0', 'example.com'], stdout=self.devnull), 0)
if __name__ == '__main__':
unittest.main()