Applies to ipa-4-3 and master. Reason in commit message.
-- Milan Kubik
From 912ecd6c48149696eb8ca3c60644e5b24af6e534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Kub=C3=ADk?= <mku...@redhat.com> Date: Wed, 16 Dec 2015 16:27:34 +0100 Subject: [PATCH] ipatests: replace the test-example.com domain in tests Latest DNS patches introduced checks for the added zones. If a zone exists, the add fails if not forced. The domain test-example.com is resolvable thus causing errors in the test. Also adds missing __init__.py to the ipatests.test_cmdline package. --- ipatests/test_cmdline/__init__.py | 3 +++ ipatests/test_cmdline/test_cli.py | 57 ++++++++++++++++++++------------------- 2 files changed, 33 insertions(+), 27 deletions(-) create mode 100644 ipatests/test_cmdline/__init__.py diff --git a/ipatests/test_cmdline/__init__.py b/ipatests/test_cmdline/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..9da42e7b4d782ef596e8fda080b6c1994b901866 --- /dev/null +++ b/ipatests/test_cmdline/__init__.py @@ -0,0 +1,3 @@ +# +# Copyright (C) 2015 FreeIPA Contributors see COPYING for license +# diff --git a/ipatests/test_cmdline/test_cli.py b/ipatests/test_cmdline/test_cli.py index c2203e68f1f90505a457de5cdf17f2716cbcaa0d..ddc4c71a89a245bf2066f6ec0831cecdc3255d35 100644 --- a/ipatests/test_cmdline/test_cli.py +++ b/ipatests/test_cmdline/test_cli.py @@ -14,6 +14,8 @@ import pytest if six.PY3: unicode = str +TEST_ZONE = u'zoneadd.%(domain)s' % api.env + @pytest.mark.tier0 class TestCLIParsing(object): @@ -123,9 +125,9 @@ class TestCLIParsing(object): all=False) def test_dnsrecord_add(self): - self.check_command('dnsrecord-add test-example.com ns --a-rec=1.2.3.4', + self.check_command('dnsrecord-add %s ns --a-rec=1.2.3.4' % TEST_ZONE, 'dnsrecord_add', - dnszoneidnsname=u'test-example.com', + dnszoneidnsname=TEST_ZONE, idnsname=u'ns', arecord=u'1.2.3.4', structured=False, @@ -135,33 +137,33 @@ class TestCLIParsing(object): def test_dnsrecord_del_all(self): try: - self.run_command('dnszone_add', idnsname=u'test-example.com') + self.run_command('dnszone_add', idnsname=TEST_ZONE) except errors.NotFound: raise nose.SkipTest('DNS is not configured') try: self.run_command('dnsrecord_add', - dnszoneidnsname=u'test-example.com', + dnszoneidnsname=TEST_ZONE, idnsname=u'ns', arecord=u'1.2.3.4', force=True) with self.fake_stdin('yes\n'): - self.check_command('dnsrecord_del test-example.com ns', + self.check_command('dnsrecord_del %s ns' % TEST_ZONE, 'dnsrecord_del', - dnszoneidnsname=u'test-example.com', + dnszoneidnsname=TEST_ZONE, idnsname=u'ns', del_all=True, structured=False) with self.fake_stdin('YeS\n'): - self.check_command('dnsrecord_del test-example.com ns', + self.check_command('dnsrecord_del %s ns' % TEST_ZONE, 'dnsrecord_del', - dnszoneidnsname=u'test-example.com', + dnszoneidnsname=TEST_ZONE, idnsname=u'ns', del_all=True, structured=False) finally: - self.run_command('dnszone_del', idnsname=u'test-example.com') + self.run_command('dnszone_del', idnsname=TEST_ZONE) def test_dnsrecord_del_one_by_one(self): try: - self.run_command('dnszone_add', idnsname=u'test-example.com') + self.run_command('dnszone_add', idnsname=TEST_ZONE) except errors.NotFound: raise nose.SkipTest('DNS is not configured') try: @@ -169,26 +171,26 @@ class TestCLIParsing(object): u'2 1 FD2693C1EFFC11A8D2BE57229212A04B45663791') for record in records: self.run_command('dnsrecord_add', - dnszoneidnsname=u'test-example.com', idnsname=u'ns', + dnszoneidnsname=TEST_ZONE, idnsname=u'ns', sshfprecord=record) with self.fake_stdin('no\nyes\nyes\n'): - self.check_command('dnsrecord_del test-example.com ns', + self.check_command('dnsrecord_del %s ns' % TEST_ZONE, 'dnsrecord_del', - dnszoneidnsname=u'test-example.com', + dnszoneidnsname=TEST_ZONE, idnsname=u'ns', del_all=False, sshfprecord=records, structured=False) finally: - self.run_command('dnszone_del', idnsname=u'test-example.com') + self.run_command('dnszone_del', idnsname=TEST_ZONE) def test_dnsrecord_add_ask_for_missing_fields(self): sshfp_parts = (1, 1, u'E3B72BA346B90570EED94BE9334E34AA795CED23') with self.fake_stdin('SSHFP\n%d\n%d\n%s' % sshfp_parts): - self.check_command('dnsrecord-add test-example.com sshfp', + self.check_command('dnsrecord-add %s sshfp' % TEST_ZONE, 'dnsrecord_add', - dnszoneidnsname=u'test-example.com', + dnszoneidnsname=TEST_ZONE, idnsname=u'sshfp', sshfp_part_fp_type=sshfp_parts[0], sshfp_part_algorithm=sshfp_parts[1], @@ -201,10 +203,10 @@ class TestCLIParsing(object): # NOTE: when a DNS record part is passed via command line, it is not # converted to its base type when transfered via wire with self.fake_stdin('%d\n%s' % (sshfp_parts[1], sshfp_parts[2])): - self.check_command('dnsrecord-add test-example.com sshfp ' \ - '--sshfp-algorithm=%d' % sshfp_parts[0], + self.check_command('dnsrecord-add %s sshfp ' + '--sshfp-algorithm=%d' % (TEST_ZONE, sshfp_parts[0]), 'dnsrecord_add', - dnszoneidnsname=u'test-example.com', + dnszoneidnsname=TEST_ZONE, idnsname=u'sshfp', sshfp_part_fp_type=sshfp_parts[0], sshfp_part_algorithm=unicode(sshfp_parts[1]), # passed via cmdline @@ -215,10 +217,11 @@ class TestCLIParsing(object): force=False) with self.fake_stdin(sshfp_parts[2]): - self.check_command('dnsrecord-add test-example.com sshfp ' \ - '--sshfp-algorithm=%d --sshfp-fp-type=%d' % (sshfp_parts[0], sshfp_parts[1]), + self.check_command('dnsrecord-add %s sshfp ' + '--sshfp-algorithm=%d --sshfp-fp-type=%d' % ( + TEST_ZONE, sshfp_parts[0], sshfp_parts[1]), 'dnsrecord_add', - dnszoneidnsname=u'test-example.com', + dnszoneidnsname=TEST_ZONE, idnsname=u'sshfp', sshfp_part_fp_type=unicode(sshfp_parts[0]), # passed via cmdline sshfp_part_algorithm=unicode(sshfp_parts[1]), # passed via cmdline @@ -231,26 +234,26 @@ class TestCLIParsing(object): def test_dnsrecord_del_comma(self): try: self.run_command( - 'dnszone_add', idnsname=u'test-example.com') + 'dnszone_add', idnsname=TEST_ZONE) except errors.NotFound: raise nose.SkipTest('DNS is not configured') try: self.run_command( 'dnsrecord_add', - dnszoneidnsname=u'test-example.com', + dnszoneidnsname=TEST_ZONE, idnsname=u'test', txtrecord=u'"A pretty little problem," said Holmes.') with self.fake_stdin('no\nyes\n'): self.check_command( - 'dnsrecord_del test-example.com test', + 'dnsrecord_del %s test' % TEST_ZONE, 'dnsrecord_del', - dnszoneidnsname=u'test-example.com', + dnszoneidnsname=TEST_ZONE, idnsname=u'test', del_all=False, txtrecord=[u'"A pretty little problem," said Holmes.'], structured=False) finally: - self.run_command('dnszone_del', idnsname=u'test-example.com') + self.run_command('dnszone_del', idnsname=TEST_ZONE) def test_idrange_add(self): """ -- 2.6.4
-- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code