summaryrefslogtreecommitdiff
path: root/openstackclient/tests/unit/fakes.py
Commit message (Collapse)AuthorAgeFilesLines
* Blacken everything elseStephen Finucane2023-05-101-17/+9
| | | | | | | | | | Black used with the '-l 79 -S' flags. A future change will ignore this commit in git-blame history by adding a 'git-blame-ignore-revs' file. Change-Id: I356643d06b2cd408ccaedfe02b858aea55388949 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* config: Also mask non-prefix configryanKor2022-08-011-22/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'config show' command will show information about your current configuration. When using a 'cloud.yaml' file and the 'OS_CLOUD' environment variable, the output of this will look like so: $ openstack config show +---------------------------------------------+----------------------------------+ | Field | Value | +---------------------------------------------+----------------------------------+ | additional_user_agent | [('osc-lib', '2.6.0')] | | api_timeout | None | | auth.auth_url | https://example.com:13000 | | auth.password | <redacted> | | auth.project_domain_id | default | | auth.project_id | c73b7097d07c46f78eb4b4dcfbac5ca8 | | auth.project_name | test-project | | auth.user_domain_name | example.com | | auth.username | john-doe | ... All of the 'auth.'-prefixed values are extracted from the corresponding entry in the 'clouds.yaml' file. You'll note that the 'auth.password' value is not shown. Instead, it is masked and replaced with '<redacted>'. However, a 'clouds.yaml' file is not the only way to configure these tools. You can also use old school environment variables. By using an openrc file from Horizon (or the clouds2env tool [1]), we will set various 'OS_'-prefixed environment variables. When you use the 'config show' command with these environment variables set, we will see all of these values appear in the output *without* an 'auth.' prefix. Scanning down we will see the password value is not redacted. $ openstack config show +---------------------------------------------+----------------------------------+ | Field | Value | +---------------------------------------------+----------------------------------+ | additional_user_agent | [('osc-lib', '2.6.0')] | | api_timeout | None | ... | password | secret-password | ... This will also happen if using tokens. This is obviously incorrect. These should be masked also. Make it so. This involves enhancing our fake config generation code to generate config that looks like it came from environment variables. Change-Id: I560b928e5e6bcdcd89c409e0678dfc0d0b056c0e Story: 2008816 Task: 42260
* Remove usage of sixsongwenping2020-10-071-2/+1
| | | | | | | | | | | With python3.x, classes can use 'metaclass=' instead of 'six.add_metaclass', 'six.iteritems' and 'six.iterkeys' can be replaced by 'items' and 'keys', 'six.moves.urllib.parse' can be replaced by 'urllib.parse', 'six.StringIO' and 'six.moves.cStringIO' can be replaced by 'io.StringIO', 'six.text_type' and 'six.string_type' are just 'str'. Change-Id: I84848c0bf8ab3c36dd821141191e2725e4e3b58b
* Raise flake8-import-order version to latestSean McGinnis2020-01-101-1/+1
| | | | | | | | | | | We had this library capped at a release that is a few years old. Now that we have dropped py2 testing, we can pick up the latest version. This uncovered a few things to clean up. Mostly the fact that mock is now a part of the StdLib unittest since Python 3.3. Change-Id: I27484dd4c25378413ff16e97a35a1a46062357bc Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* Replace six.iteritems() with .items()lihaijing2020-01-091-2/+2
| | | | | | | | | | | | | | | | 1. As mentioned in [1], we should avoid using six.iteritems to achieve iterators. We can use dict.items instead, as it will return iterators in PY3 as well. And dict.items/keys will more readable. 2. In py2, the performance about list should be negligible, see the link [2]. [1] https://wiki.openstack.org/wiki/Python3 [2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html Co-Authored-By: Akihiro Motoki <amotoki@gmail.com> Change-Id: I4b9edb326444264c0f6c4ad281acaac356a07e85 Implements: blueprint replace-iteritems-with-items
* Adding api_version to FakeAppTelles Nobrega2018-06-241-0/+1
| | | | | | | | | | In order to use app.api_version['<some_service>'] we need to have the api_version on FakeApp otherwise the test will fail. Patch that will benefit from this: https://review.openstack.org/#/c/572536/ Change-Id: Ibb3c548daf2a62b6c4aefb5e257372dd5c56521e
* Fix limits show command without Nova and CinderJude Cross2018-04-031-0/+8
| | | | | | | | | This patch implements an endpoint lookup when showing limits. This addresses the issue when showing limits without both Nova and Cinder and will display limits if one is missing. Change-Id: I2214b281e0206f8fe117aae52de2bf4c4e2c6525 Closes-bug: #1707960
* Use flake8-import-order pluginAkihiro Motoki2017-08-171-1/+1
| | | | | | | | | | | | | | | | In reviews we usually check import grouping but it is boring. By using flake8-import-order plugin, we can avoid this. It enforces loose checking so it sounds good to use it. This flake8 plugin is already used in tempest. Note that flake8-import-order version is pinned to avoid unexpected breakage of pep8 job. Setup for unit tests of hacking rules is tweaked to disable flake8-import-order checks. This extension assumes an actual file exists and causes hacking rule unit tests. Change-Id: I12b596820727aeeb379bee16c2bc993dee9eb637
* Low-level Compute v2 API: security groupDean Troyer2017-04-111-0/+3
| | | | | | | | | | api.compute.APIv2 starts with security group functions. novaclient 8.0 is now released without support for the previously deprecated nova-net functions, so include a new low-level REST implementation of the removed APIs. Change-Id: Id007535f0598226a8202716232313e37fe6247f9
* Show openstacksdk version info in "module list"Rui Chen2017-02-221-0/+3
| | | | | | | | | openstacksdk bug/1588823 exist, no good way to add __version__ for openstack module properly, fix the issue in osc side, make openstacksdk module information be available. Change-Id: I27ff61792443d1aa07f31598bed3aa32f924ff40 Partial-Bug: #1662058
* Merge "Add support for Network QoS rule commands"Jenkins2017-01-111-0/+6
|\
| * Add support for Network QoS rule commandsRodolfo Alonso Hernandez2017-01-091-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added following commands: - network qos rule create --type minimum-bandwidth dscp-marking limit-bandwidth - network qos rule delete - network qos rule list - network qos rule set - network qos rule show Closes-Bug: 1609472 Depends-On: I2e8869750024a8ccbc7777b95fe8ef6e26ec0885 Depends-On: Ife549ff6499217ca65e2554be8ef86ea7866b2d8 Change-Id: Ib3e1951f0917f5f23c8d9e0a380d19da2b3af5f0
* | Fix Octavia gate breakage caused by _get_columns()Nir Magnezi2017-01-091-0/+3
|/ | | | | | | | | | | The above mentioned function tries to extract keys() from an item which is type class. This patch fixes the issue by converting item to dict by using to_dict(). Change-Id: Ida520ae9fe64171d105f486ba06eda127a24547b Closes-Bug: #1654887
* Update default nova api version to 2.1qtang2016-09-281-1/+1
| | | | | | | | | | Ref:https://review.openstack.org/#/c/311653/ We should use 2.1 as the default nova version now The API_MIN_VERSION of novaclient has already changed to 2.1 Change-Id: I9ff16cf052556e5d3756f81e02a8e76e8f315df5 Closes-bug: #1588171
* Replace 'MagicMock' with 'Mock'qtang2016-09-141-1/+1
| | | | | Change-Id: I7aeceede6bd3cb88cf04f398454f9758dbee20f1 Closes-Bug: #1475722
* move unit tests to new "unit" test moduleSteve Martinelli2016-09-081-0/+242
this will better isolate the unit tests from the functional tests. unfortunately, the "integration" tests had to be lumped into the "unit" tests since we need the separation in testr.conf Change-Id: Ifd12198c1f90e4e3c951c73bfa1884ab300d8ded