summaryrefslogtreecommitdiffstats
path: root/ipatests/test_cmdline
diff options
context:
space:
mode:
authorMilan KubĂ­k <mkubik@redhat.com>2015-12-16 16:27:34 +0100
committerMartin Basti <mbasti@redhat.com>2015-12-17 15:15:28 +0100
commitaa648bcedcdb06162f1e578731ecf7fba299b709 (patch)
tree950cfd61f0579918a2c69b228ac9506baa967484 /ipatests/test_cmdline
parent53b60546e43caecdfb0d9e1b91cd5f309d08cf52 (diff)
downloadfreeipa-aa648bcedcdb06162f1e578731ecf7fba299b709.tar.gz
freeipa-aa648bcedcdb06162f1e578731ecf7fba299b709.tar.xz
freeipa-aa648bcedcdb06162f1e578731ecf7fba299b709.zip
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. Reviewed-By: Oleg Fayans <ofayans@redhat.com>
Diffstat (limited to 'ipatests/test_cmdline')
-rw-r--r--ipatests/test_cmdline/__init__.py3
-rw-r--r--ipatests/test_cmdline/test_cli.py57
2 files changed, 33 insertions, 27 deletions
diff --git a/ipatests/test_cmdline/__init__.py b/ipatests/test_cmdline/__init__.py
new file mode 100644
index 000000000..9da42e7b4
--- /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 c2203e68f..ddc4c71a8 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):
"""