summaryrefslogtreecommitdiff
path: root/openstackclient/tests/unit/network
diff options
context:
space:
mode:
Diffstat (limited to 'openstackclient/tests/unit/network')
-rw-r--r--openstackclient/tests/unit/network/v2/fakes.py3
-rw-r--r--openstackclient/tests/unit/network/v2/test_port.py39
2 files changed, 42 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/network/v2/fakes.py b/openstackclient/tests/unit/network/v2/fakes.py
index aec7402f..28e92d11 100644
--- a/openstackclient/tests/unit/network/v2/fakes.py
+++ b/openstackclient/tests/unit/network/v2/fakes.py
@@ -581,6 +581,7 @@ class FakePort(object):
'tenant_id': 'project-id-' + uuid.uuid4().hex,
'qos_policy_id': 'qos-policy-id-' + uuid.uuid4().hex,
'tags': [],
+ 'uplink_status_propagation': False,
}
# Overwrite default attributes.
@@ -600,6 +601,8 @@ class FakePort(object):
port.project_id = port_attrs['tenant_id']
port.security_group_ids = port_attrs['security_group_ids']
port.qos_policy_id = port_attrs['qos_policy_id']
+ port.uplink_status_propagation = port_attrs[
+ 'uplink_status_propagation']
return port
diff --git a/openstackclient/tests/unit/network/v2/test_port.py b/openstackclient/tests/unit/network/v2/test_port.py
index 78d7fd6c..8ac3e54f 100644
--- a/openstackclient/tests/unit/network/v2/test_port.py
+++ b/openstackclient/tests/unit/network/v2/test_port.py
@@ -64,6 +64,7 @@ class TestPort(network_fakes.TestNetworkV2):
'security_group_ids',
'status',
'tags',
+ 'uplink_status_propagation',
)
data = (
@@ -93,6 +94,7 @@ class TestPort(network_fakes.TestNetworkV2):
utils.format_list(fake_port.security_group_ids),
fake_port.status,
utils.format_list(fake_port.tags),
+ fake_port.uplink_status_propagation,
)
return columns, data
@@ -571,6 +573,43 @@ class TestCreatePort(TestPort):
def test_create_with_no_tag(self):
self._test_create_with_tag(add_tags=False)
+ def _test_create_with_uplink_status_propagation(self, enable=True):
+ arglist = [
+ '--network', self._port.network_id,
+ 'test-port',
+ ]
+ if enable:
+ arglist += ['--enable-uplink-status-propagation']
+ else:
+ arglist += ['--disable-uplink-status-propagation']
+ verifylist = [
+ ('network', self._port.network_id,),
+ ('name', 'test-port'),
+ ]
+ if enable:
+ verifylist.append(('enable_uplink_status_propagation', True))
+ else:
+ verifylist.append(('disable_uplink_status_propagation', True))
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ columns, data = (self.cmd.take_action(parsed_args))
+
+ self.network.create_port.assert_called_once_with(**{
+ 'admin_state_up': True,
+ 'network_id': self._port.network_id,
+ 'propagate_uplink_status': enable,
+ 'name': 'test-port',
+ })
+
+ self.assertEqual(self.columns, columns)
+ self.assertEqual(self.data, data)
+
+ def test_create_with_uplink_status_propagation_enabled(self):
+ self._test_create_with_uplink_status_propagation(enable=True)
+
+ def test_create_with_uplink_status_propagation_disabled(self):
+ self._test_create_with_uplink_status_propagation(enable=False)
+
class TestDeletePort(TestPort):