summaryrefslogtreecommitdiff
path: root/functional/tests
diff options
context:
space:
mode:
authorHuanxuan Ao <huanxuan.ao@easystack.cn>2016-08-02 19:30:25 +0800
committerHuanxuan Ao <huanxuan.ao@easystack.cn>2016-08-03 10:49:57 +0800
commitfac321458166cccffc0eb1d13a986a01c9e6d33e (patch)
tree44cdcd6377652ae8b607678e645d4dc7cd6aff93 /functional/tests
parent2a1c2b227581477a1d010b5dbc5e92657b3ba372 (diff)
downloadpython-openstackclient-fac321458166cccffc0eb1d13a986a01c9e6d33e.tar.gz
Implement "network rbac set" command
Add "network rbac set" command which just supports setting a target project. Also, This patch adds the doc, unit test and functional test. But there is a bug of showing network RBAC https://bugs.launchpad.net/python-openstacksdk/+bug/1608903 We need to skip the functional test before this bug fixed. Change-Id: I756f448bb333cf1098a735e57a1c5dc4edf195d4 Partially-Implements: blueprint neutron-client-rbac
Diffstat (limited to 'functional/tests')
-rw-r--r--functional/tests/network/v2/test_network_rbac.py29
1 files changed, 25 insertions, 4 deletions
diff --git a/functional/tests/network/v2/test_network_rbac.py b/functional/tests/network/v2/test_network_rbac.py
index 5d8cc1cc..e7e35858 100644
--- a/functional/tests/network/v2/test_network_rbac.py
+++ b/functional/tests/network/v2/test_network_rbac.py
@@ -12,12 +12,15 @@
import uuid
+import testtools
+
from functional.common import test
class NetworkRBACTests(test.TestCase):
"""Functional tests for network rbac. """
NET_NAME = uuid.uuid4().hex
+ PROJECT_NAME = uuid.uuid4().hex
OBJECT_ID = None
ID = None
HEADERS = ['ID']
@@ -39,10 +42,10 @@ class NetworkRBACTests(test.TestCase):
@classmethod
def tearDownClass(cls):
- raw_output = cls.openstack('network rbac delete ' + cls.ID)
- cls.assertOutput('', raw_output)
- raw_output = cls.openstack('network delete ' + cls.OBJECT_ID)
- cls.assertOutput('', raw_output)
+ raw_output_rbac = cls.openstack('network rbac delete ' + cls.ID)
+ raw_output_network = cls.openstack('network delete ' + cls.OBJECT_ID)
+ cls.assertOutput('', raw_output_rbac)
+ cls.assertOutput('', raw_output_network)
def test_network_rbac_list(self):
opts = self.get_opts(self.HEADERS)
@@ -53,3 +56,21 @@ class NetworkRBACTests(test.TestCase):
opts = self.get_opts(self.FIELDS)
raw_output = self.openstack('network rbac show ' + self.ID + opts)
self.assertEqual(self.ID + "\n", raw_output)
+
+ # TODO(Huanxuan Ao): This test can pass after bug
+ # https://bugs.launchpad.net/python-openstackclient/+bug/1608903 fixed.
+ @testtools.skip(
+ 'Skip because of the bug '
+ 'https://bugs.launchpad.net/python-openstackclient/+bug/1608903')
+ def test_network_rbac_set(self):
+ opts = self.get_opts(self.FIELDS)
+ project_id = self.openstack(
+ 'project create ' + self.PROJECT_NAME + opts)
+ self.openstack('network rbac set ' + self.ID +
+ ' --target-project ' + self.PROJECT_NAME)
+ opts = self.get_opts(['target_project'])
+ raw_output_rbac = self.openstack('network rbac show ' + self.ID + opts)
+ raw_output_project = self.openstack(
+ 'project delete ' + self.PROJECT_NAME)
+ self.assertEqual(project_id, raw_output_rbac)
+ self.assertOutput('', raw_output_project)