In Django 3.2, assertQuerysetEqual started to compare querystes directly.
As the migration check it checks the first element of the compared items
have a same type. "values()" method of OrderedDict does not return an object
which allows the index access in Python3, so this change breaks our UT.
We need to ensure to pass a list to assertQuerysetEqual.
The commit changes the related codes to ensure a list for such cases.
[1] 3f7b327562
Change-Id: If0a9d17c30de73a9870d0ebf3b3a82a14179c23d
In python3, super() does not always require a class and self reference.
In other words, super() is enough for most cases.
This is much simpler and it is time to switch it to the newer style.
pylint provides a check for this.
Let's enable 'super-with-arguments' check.
NOTE: _prepare_mappings() method of FormRegion in
openstack_dashboard/test/integration_tests/regions/forms.py is refactored.
super() (without explicit class and self referece) does not work when
a subclass method calls a same method in a parent class multiple times.
It looks better to prepare a separate method to provide a common logic.
Change-Id: Id9512a14be9f20dbd5ebd63d446570c7b7c825ff
Changes test invocation from `manage.py test` to `pytest`. Adds addtitional
test requirements like pytest, pytest-django, pytest-html. Adds
`pytest.mark` alongside django's test `tag`. Adds posibility to export test
results into xml and html formats.
Depends-On: https://review.opendev.org/#/c/712315/
Related-Bug: #1866666
Co-Authored-By: Ivan Kolodyazhny <e0ne@e0ne.info>
Change-Id: Idb6e63cd23ca2ba8ca56f36eb8b63069bd211944
The get_dashboards() method used sorted(<values>) to sort the
dashboards that have been registered manually. This breaks if
two or more are registered that way because the Dashboard class
doesn't define a natural ordering. The fix is to sort using
the Dashboard name as the sort key. (Unit test included.)
This problem doesn't occur in python 2.7.
P.S.
It turns out that AdminPanel in horizon/test/unit/test_base.py is not
used during the review. It is dropped too as it is a simple change.
Change-Id: I6be10a92a1f43b3e0effee8148987c7e2c5690ff
Closes-bug: #1836295
We don't support Python 2 anymore so we don't need this
compatibility library.
six.reraise usages are left as is until it'll be moved to some
base lib like oslo.utils to not re-implenent this method in
Horizon.
This patch also removes Python2-specific base test case methods
assertItemsEqual and assertNotRegexpMatches in flavor of new
Python 3 analogues.
Change-Id: I0b567382edf4d68674a7b8d0b02333fb57293958
Add a new config SESSION_REFRESH (default True) which
turns SESSION_TIMEOUT into an idle timeout rather than
a hard timeout.
The existing hard timeout is awful UX, and while
SESSION_TIMEOUT could be set to a higher value, it
still makes for a somewhat unpleasant experience.
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: Icc6942e62c4e8d2fac57988b0a2233a8073b1944
Angular errors on login page are caused by loading ngdetails view.
Although registration of URL for ngdetails is executed on top level
of Horizon, ngdetails view is not needed to be loaded in login page,
i.e. openstack_auth side.
To fix this issue, this patch moves registration of URL for ngdetails
into openstack_dashboard side.
Change-Id: Ib039417b4e666c2341f17ac05fd7723bc758816c
Closes-Bug: #1754133
Closes-Bug: #1753557
After Django 2.0 support, we no longer supports Django 1.10 or older
(Actually Django 1.10 seems to work though).
The current django.VERSION branches are all related to Django 1.10
or older, so we can drop all conditions.
py35dj20 job is now voting.
blueprint django2-support
Change-Id: Iefc0ab1c62c82f2842ec7761a9b981da9351cbd2
(In Django 2.0) The django.core.urlresolvers module is removed
in favor of its new location, django.urls.
It was depreacted in Django 1.10:
https://docs.djangoproject.com/en/2.0/releases/1.10/#id3
blueprint django2-support
Change-Id: I46ab5c325491274b8eaffbf848e5d80f83c2fd26
For now, refreshing ngdetails view by browser using F5 key or reload
button, it causes 404 error from django. To fix this issue, this patch
adds the url for '/ngdetails' into django.
To reproduce navigations, each request for views.py requires
'dashboard' and 'panel' object. Otherwise django side returns
500 error.
However the URL for request of details page (i.e. /ngdetails/)
can not provide informations to set the proper navigation.
So this patch set them to default dashboard and default panel.
This patch focuses to prevent 500 error. So the issue for
settings of proper navigation will be fixed by subsequent patch.
Change-Id: Ib9f1fe48b3cdecff5ad56e68a5ba58a41cb35f38
Closes-Bug: #1681627
blueprint relocation-test-codes
The current test file structure in horizon looks random.
This is the first patch of blueprint relocation-test-codes.
This commit proposes to change the structure to match the structure
of test targets (i.e., main codes).
More concretely, a unit test file for {TOP_MODULE}/{MODULE}/{FILENAME}.py
will be located at {TOP_MODULE}/test/units/{MODULE}/test_{FILENAME}.py.
When a module is test as a whole, a location of a corresponding test file
will be {TOP_MODULE}/test/units/{MODULE}/test_{MODULE}.py.
This clarifies locations of test files.
In addition, this commit changes the base class of utils.test_secret_key
from horizon.test.helper.TestCase to unittest.TestCase. This is because
calling secret_key.generate_key() somehow interferes django.test.TestCase
(which is a parent class of horizon.test.helper.TestCase).
Change-Id: I48b9c317645e63a5819c52512b30f25969574817