diff options
| author | Huanxuan Ao <huanxuan.ao@easystack.cn> | 2016-07-25 17:37:41 +0800 |
|---|---|---|
| committer | Huanxuan Ao <huanxuan.ao@easystack.cn> | 2016-07-28 10:23:29 +0800 |
| commit | 13bc3793e0f0378db0151acb171dbe5f2d9c08dd (patch) | |
| tree | b9b452b8f59d282a223ae60467d795f75a724b67 /functional | |
| parent | a8880e8b34c1a0609a7b1c8f54de1f0199969a1c (diff) | |
| download | python-openstackclient-13bc3793e0f0378db0151acb171dbe5f2d9c08dd.tar.gz | |
Implement network rbac create and delete commands
Add "network rbac create" and "network rbac delete" commands
and also add unit tests, functional tests, docs and release
note for them.
Change-Id: I5fd58342f2deaa9bae7717412a942a21bbd7d045
Partially-Implements: blueprint neutron-client-rbac
Diffstat (limited to 'functional')
| -rw-r--r-- | functional/tests/network/v2/test_network_rbac.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/functional/tests/network/v2/test_network_rbac.py b/functional/tests/network/v2/test_network_rbac.py new file mode 100644 index 00000000..5d8cc1cc --- /dev/null +++ b/functional/tests/network/v2/test_network_rbac.py @@ -0,0 +1,55 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import uuid + +from functional.common import test + + +class NetworkRBACTests(test.TestCase): + """Functional tests for network rbac. """ + NET_NAME = uuid.uuid4().hex + OBJECT_ID = None + ID = None + HEADERS = ['ID'] + FIELDS = ['id'] + + @classmethod + def setUpClass(cls): + opts = cls.get_opts(cls.FIELDS) + raw_output = cls.openstack('network create ' + cls.NET_NAME + opts) + cls.OBJECT_ID = raw_output.strip('\n') + opts = cls.get_opts(['id', 'object_id']) + raw_output = cls.openstack('network rbac create ' + + cls.OBJECT_ID + + ' --action access_as_shared' + + ' --target-project admin' + + ' --type network' + opts) + cls.ID, object_id, rol = tuple(raw_output.split('\n')) + cls.assertOutput(cls.OBJECT_ID, object_id) + + @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) + + def test_network_rbac_list(self): + opts = self.get_opts(self.HEADERS) + raw_output = self.openstack('network rbac list' + opts) + self.assertIn(self.ID, raw_output) + + def test_network_rbac_show(self): + opts = self.get_opts(self.FIELDS) + raw_output = self.openstack('network rbac show ' + self.ID + opts) + self.assertEqual(self.ID + "\n", raw_output) |
