summaryrefslogtreecommitdiff
path: root/openstackclient/tests
diff options
context:
space:
mode:
authorDean Troyer <dtroyer@gmail.com>2020-01-13 11:13:42 -0600
committerDean Troyer <dtroyer@gmail.com>2020-01-14 09:53:13 -0600
commit68aa35f35f21476085e25ad2e3da51a1961948e4 (patch)
treec516e1deca25f5ed0a1fde4f7831a3a183c13a14 /openstackclient/tests
parentb4e9b225b4435a7a3598b70617c1e6eb73613fa0 (diff)
downloadpython-openstackclient-68aa35f35f21476085e25ad2e3da51a1961948e4.tar.gz
Add unit tests and release note for dns_publish_fixed_ip
Follow-up to https://review.opendev.org/#/c/679834/ which added the options and lacked both a release note and minimal option-handling unit tests. Change-Id: Ibb2820add9b2fedaf5a8b1a77babf043f6641724 Signed-off-by: Dean Troyer <dtroyer@gmail.com>
Diffstat (limited to 'openstackclient/tests')
-rw-r--r--openstackclient/tests/unit/network/v2/test_subnet.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/network/v2/test_subnet.py b/openstackclient/tests/unit/network/v2/test_subnet.py
index 9903b042..d34be18c 100644
--- a/openstackclient/tests/unit/network/v2/test_subnet.py
+++ b/openstackclient/tests/unit/network/v2/test_subnet.py
@@ -460,6 +460,44 @@ class TestCreateSubnet(TestSubnet):
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
+ def _test_create_with_dns(self, publish_dns=True):
+ arglist = [
+ "--subnet-range", self._subnet.cidr,
+ "--network", self._subnet.network_id,
+ self._subnet.name,
+ ]
+ if publish_dns:
+ arglist += ['--dns-publish-fixed-ip']
+ else:
+ arglist += ['--no-dns-publish-fixed-ip']
+ verifylist = [
+ ('name', self._subnet.name),
+ ('subnet_range', self._subnet.cidr),
+ ('network', self._subnet.network_id),
+ ('ip_version', self._subnet.ip_version),
+ ('gateway', 'auto'),
+ ]
+ verifylist.append(('dns_publish_fixed_ip', publish_dns))
+
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+ columns, data = (self.cmd.take_action(parsed_args))
+
+ self.network.create_subnet.assert_called_once_with(
+ cidr=self._subnet.cidr,
+ ip_version=self._subnet.ip_version,
+ name=self._subnet.name,
+ network_id=self._subnet.network_id,
+ dns_publish_fixed_ip=publish_dns,
+ )
+ self.assertEqual(self.columns, columns)
+ self.assertItemEqual(self.data, data)
+
+ def test_create_with_dns(self):
+ self._test_create_with_dns(publish_dns=True)
+
+ def test_create_with_no_dns(self):
+ self._test_create_with_dns(publish_dns=False)
+
def _test_create_with_tag(self, add_tags=True):
arglist = [
"--subnet-range", self._subnet.cidr,