Compare commits
9 Commits
train-eol
...
ussuri-eol
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ded5189ba | ||
|
|
1419988ace | ||
|
|
21addfcca0 | ||
|
|
56681c318e | ||
|
|
5bd1b2feeb | ||
|
|
05139e97e8 | ||
|
|
c4e27f2e6d | ||
|
|
1a98ae3101 | ||
|
|
9cd38596cd |
@@ -3,9 +3,6 @@
|
||||
- check-requirements
|
||||
- openstack-cover-jobs
|
||||
- openstack-lower-constraints-jobs
|
||||
- openstack-python-jobs
|
||||
- openstack-python35-jobs
|
||||
- openstack-python36-jobs
|
||||
- openstack-python37-jobs
|
||||
- openstack-python3-ussuri-jobs
|
||||
- openstackclient-plugin-jobs
|
||||
- publish-openstack-docs-pti
|
||||
|
||||
@@ -36,7 +36,7 @@ Karbor Mission Statement
|
||||
.. _Launchpad project: https://launchpad.net/python-karborclient
|
||||
.. _Blueprints: https://blueprints.launchpad.net/python-karborclient
|
||||
.. _Bugs: https://bugs.launchpad.net/python-karborclient
|
||||
.. _Source: https://git.openstack.org/cgit/openstack/python-karborclient
|
||||
.. _Source: https://opendev.org/openstack/python-karborclient
|
||||
.. _Specs: https://docs.openstack.org/karbor/latest/specs/index.html
|
||||
.. _How to Contribute: https://docs.openstack.org/infra/manual/developers.html
|
||||
|
||||
|
||||
@@ -21,6 +21,22 @@ mock_request_return = ({}, {'operation_log': {}})
|
||||
|
||||
class OperationLogsTest(base.TestCaseShell):
|
||||
|
||||
@mock.patch('karborclient.common.http.HTTPClient.json_request')
|
||||
def test_list_operation_logs(self, mock_request):
|
||||
mock_request.return_value = mock_request_return
|
||||
cs.operation_logs.list()
|
||||
mock_request.assert_called_with(
|
||||
'GET',
|
||||
'/operation_logs', headers={})
|
||||
|
||||
@mock.patch('karborclient.common.http.HTTPClient.json_request')
|
||||
def test_list_operation_logs_with_all_tenants(self, mock_request):
|
||||
mock_request.return_value = mock_request_return
|
||||
cs.operation_logs.list(search_opts={'all_tenants': 1})
|
||||
mock_request.assert_called_with(
|
||||
'GET',
|
||||
'/operation_logs?all_tenants=1', headers={})
|
||||
|
||||
@mock.patch('karborclient.common.http.HTTPClient.json_request')
|
||||
def test_list_operation_logs_with_marker_limit(self, mock_request):
|
||||
mock_request.return_value = mock_request_return
|
||||
|
||||
@@ -30,6 +30,15 @@ class QuotaClassesTest(base.TestCaseShell):
|
||||
'/quota_classes/default',
|
||||
data={'quota_class': {'plans': 50}}, headers={})
|
||||
|
||||
@mock.patch('karborclient.common.http.HTTPClient.json_request')
|
||||
def test_quota_class_update_with_none(self, mock_request):
|
||||
mock_request.return_value = mock_request_return
|
||||
cs.quota_classes.update('default', {'plans': None})
|
||||
mock_request.assert_called_with(
|
||||
'PUT',
|
||||
'/quota_classes/default',
|
||||
data={'quota_class': {'plans': 50}}, headers={})
|
||||
|
||||
@mock.patch('karborclient.common.http.HTTPClient.json_request')
|
||||
def test_show_quota_class(self, mock_request):
|
||||
mock_request.return_value = mock_request_return
|
||||
@@ -38,3 +47,12 @@ class QuotaClassesTest(base.TestCaseShell):
|
||||
'GET',
|
||||
'/quota_classes/default',
|
||||
headers={})
|
||||
|
||||
@mock.patch('karborclient.common.http.HTTPClient.json_request')
|
||||
def test_show_quota_class_with_headers(self, mock_request):
|
||||
mock_request.return_value = mock_request_return
|
||||
cs.quota_classes.get('default', session_id='fake_session_id')
|
||||
mock_request.assert_called_with(
|
||||
'GET',
|
||||
'/quota_classes/default',
|
||||
headers={'X-Configuration-Session': 'fake_session_id'})
|
||||
|
||||
@@ -30,6 +30,15 @@ class QuotasTest(base.TestCaseShell):
|
||||
'/quotas/{project_id}'.format(project_id=fakes.PROJECT_ID),
|
||||
data={'quota': {'plans': 50}}, headers={})
|
||||
|
||||
@mock.patch('karborclient.common.http.HTTPClient.json_request')
|
||||
def test_quota_update_with_none(self, mock_request):
|
||||
mock_request.return_value = mock_request_return
|
||||
cs.quotas.update(fakes.PROJECT_ID, {'plans': None})
|
||||
mock_request.assert_called_with(
|
||||
'PUT',
|
||||
'/quotas/{project_id}'.format(project_id=fakes.PROJECT_ID),
|
||||
data={'quota': {'plans': 50}}, headers={})
|
||||
|
||||
@mock.patch('karborclient.common.http.HTTPClient.json_request')
|
||||
def test_show_quota(self, mock_request):
|
||||
mock_request.return_value = mock_request_return
|
||||
@@ -39,6 +48,15 @@ class QuotasTest(base.TestCaseShell):
|
||||
'/quotas/{project_id}'.format(project_id=fakes.PROJECT_ID),
|
||||
headers={})
|
||||
|
||||
@mock.patch('karborclient.common.http.HTTPClient.json_request')
|
||||
def test_show_quota_with_headers(self, mock_request):
|
||||
mock_request.return_value = mock_request_return
|
||||
cs.quotas.get(fakes.PROJECT_ID, False, session_id='fake_session_id')
|
||||
mock_request.assert_called_with(
|
||||
'GET',
|
||||
'/quotas/{project_id}'.format(project_id=fakes.PROJECT_ID),
|
||||
headers={'X-Configuration-Session': 'fake_session_id'})
|
||||
|
||||
@mock.patch('karborclient.common.http.HTTPClient.json_request')
|
||||
def test_show_quota_with_detail(self, mock_request):
|
||||
mock_request.return_value = mock_request_return
|
||||
@@ -58,3 +76,13 @@ class QuotasTest(base.TestCaseShell):
|
||||
'/quotas/{project_id}/defaults'.format(
|
||||
project_id=fakes.PROJECT_ID),
|
||||
headers={})
|
||||
|
||||
@mock.patch('karborclient.common.http.HTTPClient.json_request')
|
||||
def test_show_quota_default_with_headers(self, mock_request):
|
||||
mock_request.return_value = mock_request_return
|
||||
cs.quotas.defaults(fakes.PROJECT_ID, session_id='fake_session_id')
|
||||
mock_request.assert_called_with(
|
||||
'GET',
|
||||
'/quotas/{project_id}/defaults'.format(
|
||||
project_id=fakes.PROJECT_ID),
|
||||
headers={'X-Configuration-Session': 'fake_session_id'})
|
||||
|
||||
@@ -22,6 +22,22 @@ mock_request_return = ({}, {'trigger_info': {'name': 'fake_name'}})
|
||||
|
||||
class TriggersTest(base.TestCaseShell):
|
||||
|
||||
@mock.patch('karborclient.common.http.HTTPClient.json_request')
|
||||
def test_list_triggers(self, mock_request):
|
||||
mock_request.return_value = mock_request_return
|
||||
cs.triggers.list()
|
||||
mock_request.assert_called_with(
|
||||
'GET',
|
||||
'/triggers', headers={})
|
||||
|
||||
@mock.patch('karborclient.common.http.HTTPClient.json_request')
|
||||
def test_list_triggers_with_all_tenants(self, mock_request):
|
||||
mock_request.return_value = mock_request_return
|
||||
cs.triggers.list(search_opts={'all_tenants': 1})
|
||||
mock_request.assert_called_with(
|
||||
'GET',
|
||||
'/triggers?all_tenants=1', headers={})
|
||||
|
||||
@mock.patch('karborclient.common.http.HTTPClient.json_request')
|
||||
def test_list_triggers_with_marker_limit(self, mock_request):
|
||||
mock_request.return_value = mock_request_return
|
||||
@@ -103,3 +119,9 @@ class TriggersTest(base.TestCaseShell):
|
||||
data=body,
|
||||
headers={}
|
||||
)
|
||||
|
||||
def test_update_trigger_with_invalid_window(self):
|
||||
trigger_id = '123'
|
||||
self.assertRaises(exceptions.CommandError,
|
||||
cs.triggers.update,
|
||||
trigger_id, {'properties': {'window': 'fake'}})
|
||||
|
||||
@@ -26,6 +26,9 @@ class QuotaClassManager(base.ManagerWithFind):
|
||||
|
||||
def update(self, class_name, data):
|
||||
|
||||
if "plans" in data and data["plans"] is None:
|
||||
data["plans"] = 50
|
||||
|
||||
body = {"quota_class": data}
|
||||
|
||||
return self._update('/quota_classes/{class_name}'
|
||||
|
||||
@@ -26,6 +26,9 @@ class QuotaManager(base.ManagerWithFind):
|
||||
|
||||
def update(self, project_id, data):
|
||||
|
||||
if "plans" in data and data["plans"] is None:
|
||||
data["plans"] = 50
|
||||
|
||||
body = {"quota": data}
|
||||
|
||||
return self._update('/quotas/{project_id}'
|
||||
|
||||
@@ -1357,7 +1357,7 @@ def _quota_set_pretty_show(quotas):
|
||||
metavar='<plans>',
|
||||
type=int,
|
||||
default=None,
|
||||
help='New value for the "plans" quota.')
|
||||
help='New value for the "plans" quota. The default value is 50.')
|
||||
def do_quota_update(cs, args):
|
||||
"""Update the quotas for a project (Admin only)."""
|
||||
project_id = args.tenant
|
||||
@@ -1400,7 +1400,7 @@ def do_quota_class_show(cs, args):
|
||||
metavar='<plans>',
|
||||
type=int,
|
||||
default=None,
|
||||
help='New value for the "plans" quota.')
|
||||
help='New value for the "plans" quota. The default value is 50.')
|
||||
def do_quota_class_update(cs, args):
|
||||
"""Update the quotas for a quota class (Admin only)."""
|
||||
class_name = args.class_name
|
||||
|
||||
6
releasenotes/notes/drop-py-2-7-7a92a5906980666b.yaml
Normal file
6
releasenotes/notes/drop-py-2-7-7a92a5906980666b.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
Python 2.7 support has been dropped. Last release of python-karborclient
|
||||
to support python 2.7 is OpenStack Train. The minimum version of Python now
|
||||
supported is Python 3.6.
|
||||
@@ -13,11 +13,9 @@ classifier =
|
||||
License :: OSI Approved :: Apache Software License
|
||||
Operating System :: POSIX :: Linux
|
||||
Programming Language :: Python
|
||||
Programming Language :: Python :: 2
|
||||
Programming Language :: Python :: 2.7
|
||||
Programming Language :: Python :: 3
|
||||
Programming Language :: Python :: 3.5
|
||||
Programming Language :: Python :: 3.6
|
||||
Programming Language :: Python :: 3.7
|
||||
|
||||
[global]
|
||||
setup-hooks =
|
||||
|
||||
12
tox.ini
12
tox.ini
@@ -1,9 +1,11 @@
|
||||
[tox]
|
||||
minversion = 2.0
|
||||
envlist = py35,py27,pypy,pep8
|
||||
minversion = 3.1.1
|
||||
envlist = py37,pypy,pep8
|
||||
skipsdist = True
|
||||
ignore_basepython_conflict = True
|
||||
|
||||
[testenv]
|
||||
basepython = python3
|
||||
usedevelop = True
|
||||
install_command = pip install {opts} {packages}
|
||||
setenv =
|
||||
@@ -19,28 +21,23 @@ commands =
|
||||
python setup.py test --slowest --testr-args='{posargs}'
|
||||
|
||||
[testenv:pep8]
|
||||
basepython = python3
|
||||
commands = flake8
|
||||
|
||||
[testenv:venv]
|
||||
basepython = python3
|
||||
commands = {posargs}
|
||||
|
||||
[testenv:cover]
|
||||
basepython = python3
|
||||
commands =
|
||||
python setup.py test --coverage --testr-args='{posargs}'
|
||||
coverage report
|
||||
|
||||
[testenv:docs]
|
||||
basepython = python3
|
||||
deps =
|
||||
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
||||
-r{toxinidir}/doc/requirements.txt
|
||||
commands = sphinx-build -W -b html doc/source doc/build/html
|
||||
|
||||
[testenv:debug]
|
||||
basepython = python3
|
||||
commands = oslo_debug_helper -t karborclient/tests {posargs}
|
||||
|
||||
[flake8]
|
||||
@@ -51,7 +48,6 @@ builtins = _
|
||||
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools
|
||||
|
||||
[testenv:lower-constraints]
|
||||
basepython = python3
|
||||
deps =
|
||||
-c{toxinidir}/lower-constraints.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
|
||||
Reference in New Issue
Block a user