From 48e534fa03b92b2583c5c6269c76651f3aa420cb Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Fri, 7 May 2021 16:55:18 -0700 Subject: [PATCH] add +noall +answer test --- tests/fixtures/osx-10.14.6/dig-noall-answer.json | 1 + tests/fixtures/osx-10.14.6/dig-noall-answer.out | 4 ++++ tests/test_dig.py | 14 ++++++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 tests/fixtures/osx-10.14.6/dig-noall-answer.json create mode 100644 tests/fixtures/osx-10.14.6/dig-noall-answer.out diff --git a/tests/fixtures/osx-10.14.6/dig-noall-answer.json b/tests/fixtures/osx-10.14.6/dig-noall-answer.json new file mode 100644 index 00000000..7e50ae63 --- /dev/null +++ b/tests/fixtures/osx-10.14.6/dig-noall-answer.json @@ -0,0 +1 @@ +[{"answer":[{"name":"cnn.com.","class":"IN","type":"A","ttl":47,"data":"151.101.65.67"},{"name":"cnn.com.","class":"IN","type":"A","ttl":47,"data":"151.101.193.67"},{"name":"cnn.com.","class":"IN","type":"A","ttl":47,"data":"151.101.129.67"},{"name":"cnn.com.","class":"IN","type":"A","ttl":47,"data":"151.101.1.67"}]}] diff --git a/tests/fixtures/osx-10.14.6/dig-noall-answer.out b/tests/fixtures/osx-10.14.6/dig-noall-answer.out new file mode 100644 index 00000000..8944689d --- /dev/null +++ b/tests/fixtures/osx-10.14.6/dig-noall-answer.out @@ -0,0 +1,4 @@ +cnn.com. 47 IN A 151.101.65.67 +cnn.com. 47 IN A 151.101.193.67 +cnn.com. 47 IN A 151.101.129.67 +cnn.com. 47 IN A 151.101.1.67 diff --git a/tests/test_dig.py b/tests/test_dig.py index cba855fd..cca52ea8 100644 --- a/tests/test_dig.py +++ b/tests/test_dig.py @@ -55,10 +55,12 @@ class MyTests(unittest.TestCase): with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/dig-axfr.out'), 'r', encoding='utf-8') as f: self.osx_10_14_6_dig_axfr = f.read() + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/dig-noall-answer.out'), 'r', encoding='utf-8') as f: + self.osx_10_14_6_dig_noall_answer = f.read() + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/dig-answer-spaces.out'), 'r', encoding='utf-8') as f: self.generic_dig_answer_spaces = f.read() - with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/dig-additional.out'), 'r', encoding='utf-8') as f: self.generic_dig_additional = f.read() @@ -123,10 +125,12 @@ class MyTests(unittest.TestCase): with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/dig-axfr.json'), 'r', encoding='utf-8') as f: self.osx_10_14_6_dig_axfr_json = json.loads(f.read()) + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/dig-noall-answer.json'), 'r', encoding='utf-8') as f: + self.osx_10_14_6_dig_noall_answer_json = json.loads(f.read()) + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/dig-answer-spaces.json'), 'r', encoding='utf-8') as f: self.generic_dig_answer_spaces_json = json.loads(f.read()) - with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/dig-additional.json'), 'r', encoding='utf-8') as f: self.generic_dig_additional_json = json.loads(f.read()) @@ -241,6 +245,12 @@ class MyTests(unittest.TestCase): """ self.assertEqual(jc.parsers.dig.parse(self.osx_10_14_6_dig_axfr, quiet=True), self.osx_10_14_6_dig_axfr_json) + def test_dig_noall_answer_osx_10_14_6(self): + """ + Test 'dig +noall +answer' on OSX 10.14.6 + """ + self.assertEqual(jc.parsers.dig.parse(self.osx_10_14_6_dig_noall_answer, quiet=True), self.osx_10_14_6_dig_noall_answer_json) + def test_dig_answer_spaces(self): """ Test 'dig' with spaces in the answer data (e.g. TXT responses)