Commit Graph

17 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
Akihiro Motoki 672c43c43e Drop OPENSTACK_NOVA_EXTENSIONS_BLACKLIST finally
Part of the removal of OPENSTACK_NOVA_EXTENSIONS_BLACKLIST (3/3)

Clean up nova extensions related code in the API layer.

Change-Id: I9730095365342cac1023f4112bae4b3a28cdeaf7
2020-10-27 20:02:05 +09: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
Matt Riedemann b148c92075 Remove dependency on novaclient list_extensions API
The novaclient list_extensions API binding was removed in the
16.0.0 release [1]. The ability to enable/disable extensions
in nova has been deprecated since Liberty [2] and was removed
in Newton [3].

For horizon this only matters for the OPENSTACK_NOVA_EXTENSIONS_BLACKLIST
config setting and some javascript code used to compile panels based on
enabled extensions. In order to work with novaclient 16.0.0+, this
change removes the list_extensions usage since all extensions
are enabled in nova and thus for horizon a nova extension is only
not supported if it's in the configured blacklist. To continue supporting
the javascript code which uses the getExtensions function, the extension
names are hard-coded. Note that the method meant to test that code,
_test_extension_list, was wrong but never ran because of the underscore
prefix on the method name. That is fixed here.

[1] https://review.opendev.org/686516/
[2] https://review.opendev.org/214592/
[3] https://review.opendev.org/351362/

Change-Id: Iebb1e78c718b931d632445e4de6d7a29ccb92be2
Closes-Bug: #1847959
2019-10-24 15:24:39 -04:00
Daniel Vincze e332cef01c Add key_type selection on Keypairs form
Key type can be selected through both Django and Angular panels.
This change will allow X509 Public Certificates to be imported
or created through Horizon.

Also, the key type is being showed in the keypairs list.

Change-Id: I0a07b4805e6af96f06ec12d2e86708c94946e9c9
Closes-Bug: 1816041
2019-03-13 16:32:06 +02:00
Feilong Wang cf06d278af Get flavor list sorted when launching instance
Currently, the flavor list is random on the panel of booting
instance, which is not a good experience for end user. This
patch fixes it and adds test accordingly.

Closes-Bug: #1715042

Change-Id: Id5369ab75487d214a3395ba507b4394d4497903e
2018-05-30 22:54:31 +00: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
Akihiro Motoki 65f43d21bd Improve mocking in REST API tests (test_nova)
The current REST API tests have a lot of rooms to be improved like:
- mocking the whole module of the API wrapper
- Some expected status code was 200 wrongly because mock.Mokc()
  object was returned from mocked methods. 204 is the correct
  response status code.

Change-Id: Ib3d6af27e94fb5577e259078d0215b1ace8617e1
Partial-Bug: #1752917
2018-03-28 09:51:17 +09:00
Zuul 8956bd23a2 Merge "Add angular server group details page" 2018-03-20 03:56:03 +00:00
Zuul 5b9a34d401 Merge "Add angular delete server groups action" 2018-03-20 03:56:00 +00:00
Zuul 6d3cb836a0 Merge "Add angular create server group action" 2018-03-20 03:38:01 +00:00
wei.ying 940ff111a1 Add angular server group details page
This patch adds angular server group details page to show details of
the given server group, also shows the server group members under the
current server group.

Change-Id: I5b903972dd4fc5c9f1b52f97bdd7e0852d7d00d3
Partial-Implements: blueprint ng-server-groups
2018-03-18 22:42:43 +08:00
wei.ying 37647dd318 Add angular delete server groups action
This patch adds delete actions for angular server groups panel.

Change-Id: I9cd887fb315a5523c44c48d284cdea3a6673b3b2
Partial-Implements: blueprint ng-server-groups
2018-03-18 22:20:03 +08:00
wei.ying df857f00b5 Add angular create server group action
This patch adds create server group action for angular server groups
panel.

Change-Id: Ia4354448dcb42bc5e53e2415084f0569a75a68a3
Partial-Implements: blueprint ng-server-groups
2018-03-16 23:51:41 +08:00
Akihiro Motoki 4dd60373dc Fix python 3 related test failures
In Python 3.5 with Django 2.0 env, some tests fail.
This commit fixes them.

blueprint django2-support
Change-Id: Ib5ba46d501956ebc7d4f69f17ee86f44319418d2
2018-03-03 07:33:23 +09:00
Akihiro Motoki 79ae866d57 Switch Nova API tests to mock
This patch changes mox to mock for the following test modules:
* openstack_dashboard/test/unit/api/test_nova.py
* openstack_dashboard/test/unit/api/rest/test_nova.py

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

Change-Id: I894ba4f1ab2123ce36f451013d8f7ebd70d9bd0f
2018-02-15 08:37:26 +00: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