Commit Graph

14 Commits

Author SHA1 Message Date
Akihiro Motoki 7052b7f065 Address RemovedInDjango40Warning (7)
HttpRequest.is_ajax() was marked as deprecated since Django 3.1 and will be
removed in Django 4.0 [1].

While the current implementation of is_ajax() relies on a jQuery-specific way
of signifying AJAX as noted in the Django relnotes, horizon works with this.
Thus this commit copies the existing logic of HttpRequest.is_ajax() to the
horizon repo (as horizon.utils.http.is_ajax()) and consumes it.

https: //docs.djangoproject.com/en/4.0/releases/3.1/#features-deprecated-in-3-1
Change-Id: I3def53033524985818a891a1b9d4659fad4ba2ba
2022-02-04 16:27:32 +09:00
Brian Rosmaita b58ac2894b Drop cinder v2 API support
Cinder v2 API is deprecated since pike release. Along with the removal
of cinder v2 API support in cinderclient (change I335db5c1799e drops
v2 support), this commit drops cinder v2 support in horizon.

The next release of python-cinderclient drops v2 support,
so horizon needs to use v3 classes.

Includes a workaround in unit tests for two cinderclient.v3 classes
that are missing in the cinderclient releases prior to 8.0.0.  The
workaround can be removed once cinderclient change I335db5c1799edb2
is merged and released.

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: Iab0f097fab6696462572dc6ea53767c91e5411b1
2021-07-19 08:00:58 -04:00
Ivan Kolodyazhny 14e779bbac Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: I2de669d8e89b8daeb7ee5405ffab35af6307c40b
2020-03-26 19:45:37 +02:00
Ivan Kolodyazhny f33e5fd8ac Drop deprecated Keystone V2 API support
Keystone V2 API was deprecated in Stein release in Horizon and
removed from Keystone in Queens release.

Change-Id: I917e273d3174adf0874e516b3d635ccb8ba58a27
2019-09-12 17:15:07 +00:00
Akihiro Motoki 150dcc3fb0 pylint: fix redundant-keyword-arg error
pylint complains 'name' argument is redundant
in positional and keyword arguments.
The existence of 'name' in kwargs is checked before passing to
api.keystone.tenant_create, so we can pass 'name' as part of kwargs.

Change-Id: Ice09cecb21217b042d44a8c1dda7a4736e2b391b
2019-01-17 00:47:31 +09:00
Akihiro Motoki cebe212d00 Bump hacking to 1.1.0
Fix the following new errors:
* E305 expected 2 blank lines after class or function definition, found 1
* E126 continuation line over-indented for hanging indent

max_line_length is set to 80 as the default value in pycodestyle is 79
but horizon uses 80 as max_line_length.

Ignore W504 and F405 by configurations.
Reasons of disabling them are explained as comments in tox.ini.

Change-Id: Iee8bcd60c30883fc8c74f08cf20af853cbb5e271
2018-11-10 16:44:25 +09:00
Alex Petrenko 31718cd1af Refactor app response for api request '/api/keystone/svc-catalog'
Add filtration for service catalog. Now all endpoints that are not
public will not be seen.

Change-Id: I6db214f849d13c4c71e176f00113e889ff2d2997
Closes-Bug: #1798832
2018-10-23 20:30:11 +03:00
Akihiro Motoki 58019a7411 Disable mox usage by default in test helper
- Add use_mox = True to tests which still depend on mox
- Remove use_mox = False from all tests converted into mock
- Update the warning messages
- Replace 'S'-release with 'Stein'

Part of blueprint mock-framework-in-unit-tests
Change-Id: I208185e97b2de346304a09643a9cb3f1425a7683
Signed-off-by: Akihiro Motoki <amotoki@gmail.com>
2018-04-20 03:34:51 +00:00
wei.ying dc9a6a33ea Fix unauthorized exception when using member user to access angular users panel
When a member role user go to angular users panel, it will be
raised unauthorized exception since the user has no access to
get users list. It should be add a policy check mechanism at
the panel.

Change-Id: I9cfa1aeab27aca1631322d8c0b3e6a7a930d9cfe
Closes-Bug: #1694127
2018-03-31 18:57:58 +08:00
Zuul a0272cd035 Merge "Improve mocking in REST API tests (test_keystone)" 2018-03-28 16:04:44 +00:00
Akihiro Motoki dd7e281844 Improve mocking in REST API tests (test_keystone)
The current REST API tests have a lot of rooms to be improved like:
- mocking the whole module of the API wrapper

Change-Id: I799b0bce11bb06f6da64b8cc76f490f644fd457f
Partial-Bug: #1752917
2018-03-22 06:24:44 +09:00
Akihiro Motoki 5a82ff9328 Switch Keystone API tests to mock
This patch changes mox to mock for the following test modules:
* openstack_dashboard/test/unit/api/test_keystone.py
* openstack_dashboard/test/unit/api/rest/test_keystone.py

Partially-Implements: blueprint mock-framework-in-unit-tests

Change-Id: I5b57bd46359466ee28bff1531c8a9bfd93842ebe
2018-02-17 04:30:41 +09:00
jing.liuqing 4c8f4a0306 Add Angular keystone user creation action
- fix users rest API to handle description,
  project, and enabled attribute properly
- fix hz-password-match to work, but also so
  it uses model-based checks rather than HTML
  element lookups
- add schema form password-confirm type

To Test
 - set 'users_panel': True in settings.py

Co-Authored-By: Cindy Lu <clu@us.ibm.com>
Co-Authored-By: Richard Jones <r1chardj0n3s@gmail.com>
Co-Authored-By: Shu Muto <shu-mutou@rf.jp.nec.com>

Change-Id: I2e8f5ac1dbfae9634fa5b72f7f6c0278d5a81249
Partially-Implements: blueprint ng-users
2017-12-13 12:13:07 +09:00
Akihiro Motoki f3af02f20f openstack_dashboard: Move test files to match module structure
This commit relocates test codes in openstack_dashboard
according to blueprint relocation-test-codes.

Change-Id: I397a5a47fe9c1bf3a498c22056d924bf409c514b
2017-12-09 21:38:06 +09:00