diff options
| author | Kyle Mestery <mestery@mestery.com> | 2015-03-06 22:47:22 +0000 |
|---|---|---|
| committer | Kyle Mestery <mestery@mestery.com> | 2015-03-09 14:25:38 +0000 |
| commit | 9b3b253399130b98e00a823cbcbafcf5420fefa4 (patch) | |
| tree | 09ae433fa65ff4896a85a1ad87804bfd3a3c3478 /neutronclient | |
| parent | 09e27d0035f89c2203e67b53792e2ab285073f9f (diff) | |
| download | python-neutronclient-9b3b253399130b98e00a823cbcbafcf5420fefa4.tar.gz | |
First pass at tempest-lib based functional testing
Begin moving neutron CLI tests out of tempest and into this repo
using tempest-lib. This patch adds the framework to run the
functional tests, later patches will port the existing tempest
tests.
Change-Id: I1d168d7f255d08e7d7d0193b1d470b9c957c3ae8
Partila-Bug: #1429289
Diffstat (limited to 'neutronclient')
| -rw-r--r-- | neutronclient/tests/functional/__init__.py | 0 | ||||
| -rw-r--r-- | neutronclient/tests/functional/base.py | 44 | ||||
| -rw-r--r-- | neutronclient/tests/functional/test_readonly_neutron.py | 47 |
3 files changed, 91 insertions, 0 deletions
diff --git a/neutronclient/tests/functional/__init__.py b/neutronclient/tests/functional/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/neutronclient/tests/functional/__init__.py diff --git a/neutronclient/tests/functional/base.py b/neutronclient/tests/functional/base.py new file mode 100644 index 0000000..48561d6 --- /dev/null +++ b/neutronclient/tests/functional/base.py @@ -0,0 +1,44 @@ +# 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 os + +from tempest_lib.cli import base + + +class ClientTestBase(base.ClientTestBase): + """This is a first pass at a simple read only python-neutronclient test. + This only exercises client commands that are read only. + + This should test commands: + * as a regular user + * as a admin user + * with and without optional parameters + * initially just check return codes, and later test command outputs + + """ + + def _get_clients(self): + cli_dir = os.environ.get( + 'OS_NEUTRONCLIENT_EXEC_DIR', + os.path.join(os.path.abspath('.'), '.tox/functional/bin')) + + return base.CLIClient( + username=os.environ.get('OS_USERNAME'), + password=os.environ.get('OS_PASSWORD'), + tenant_name=os.environ.get('OS_TENANT_NAME'), + uri=os.environ.get('OS_AUTH_URL'), + cli_dir=cli_dir) + + def neutron(self, *args, **kwargs): + return self.clients.neutron(*args, + **kwargs) diff --git a/neutronclient/tests/functional/test_readonly_neutron.py b/neutronclient/tests/functional/test_readonly_neutron.py new file mode 100644 index 0000000..d4bf9c0 --- /dev/null +++ b/neutronclient/tests/functional/test_readonly_neutron.py @@ -0,0 +1,47 @@ +# 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. + +from tempest_lib import exceptions + +from neutronclient.tests.functional import base + + +class SimpleReadOnlyNeutronClientTest(base.ClientTestBase): + + """This is a first pass at a simple read only python-neutronclient test. + This only exercises client commands that are read only. + + This should test commands: + * as a regular user + * as a admin user + * with and without optional parameters + * initially just check return codes, and later test command outputs + + """ + + def test_admin_fake_action(self): + self.assertRaises(exceptions.CommandFailed, + self.neutron, + 'this-does-neutron-exist') + + # NOTE(mestery): Commands in order listed in 'neutron help' + + # Optional arguments: + + def test_admin_version(self): + self.neutron('', flags='--version') + + def test_admin_debug_list(self): + self.neutron('net-list', flags='--debug') + + def test_admin_timeout(self): + self.neutron('net-list', flags='--http-timeout %d' % 10) |
