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
There seems to be a couple of errors on the operation_log
middleware tests that were being ignored on the tests
runnners.
On the first we were trying to access a local var from the
OperationLogMiddleware class to compare the default log
format. This is fixed by making it an attribute instead.
The second one was an icorrect use of the delattr function
as it was used as part of the request object, while its a
standalone function.
Change-Id: Ib05cfd1d6acb940a40c8bb1d1bdf3cdf837a0454
Fixes typo in a previous patch where underscore in front
of variable name was ommited.
Change-Id: I050148607bb0016cc4d4c5852784671ad994a078
Closes-Bug: #1688206
attribute-level imports are not checked by hacking module now.
most noqa is used to disable warnings on attribute-level imports.
This commit drops noqa for this purpose.
After this, there are 8 noqa under horizon/ :)
In addition to this, the following changes are made.
horizon/exceptions.py: The following imports are dropped.
They are not used anywhere.
from django.http import HttpRequest
from django.views.debug import CLEANSED_SUBSTITUTE
horizon/forms/__init__.py:
Some entries were missing in __all__. They are added.
Change-Id: I33b504ef6c396f0675e8a340867e2ca59c77c684
To enable this feature, you can see the
/doc/source/topics/settings.rst on this patch.
Change-Id: I784b92104be244f7f288d7648c20e61e0a0c1d09
Implements: blueprint operation-history-log
This patch gets Horizon to a passing state in the Django 1.9 tests
Co-Authored-By: Itxaka <iserrano@redhat.com>
Co-Authored-By: Timur Sufiev <tsufiev@mirantis.com>
Change-Id: Icbc1a3c039de658faa9fba4a2cdd5027345fe94d
Partially-Implements: blueprint drop-dj17
Putting back timezone awareness in the middleware which was accidently removed
by https://review.openstack.org/#/c/179513/
Change-Id: I01424dee71e778969d97cbb38899d898e01177fa
Closes-bug: #1538189
This change will simplify horizon session management and lesson
the load on session backends which currently are writing records
with every page request.
Pre-Requisite change: https://review.openstack.org/#/c/179800/
Change-Id: I3ff8ca6b56655c7c68743398fee903d651332867
Closes-bug: #1450914
If both the keystone token and the session expired, the user was asked to login
twice. This is because the token expiration was not checked.
When a user had timed out both in session and keystone token validity, the user
was asked to log in, then the timestamp was checked, and the user logged out
again and asked to log in a second time.
We now check both the timestamp and keystone token validity before
authentication validity and force back the login page to retrieve a new
keystone token, avoiding the timeout race condition between session and token
validity which was forcing a dual login. A keystone token expiration is now
considered as a session timeout too.
Also, a page can start loading while the token is valid, and finish while it's
invalid. This was leading to errors during the page loading.
We now set a TOKEN_TIMEOUT_MARGIN period in seconds which allows defining
a margin before which we consider the token as expired.
This is a configurable parameter in the django settings because the time a page
takes to render is infra and deployment specific. This margin is preset to
ten seconds.
Requires: https://review.openstack.org/101556
Closes-Bug: 1308918
Change-Id: I0bf0d079a9dc000c1a30f0e20dcaa03b22d63e51
Some tests used incorrect order assertEqual(observed, expected).
The correct order expected by testtools is
assertEqual(expected, observed).
Change-Id: Iabf6e55146412b57b6a6544f312f9510f762566a
Partial-Bug: #1259292
Remove vim setting:
comment - # vim: tabstop=4 shiftwidth=4 softtabstop=4
at the top of source code files, except for files in
openstack/common.
Change-Id: I9a5c6b17c6ef7ecec601f4503dfc7b31fc72e90a
Close-bug: #1229324
We have a lot of import with #noqa that is there to ignore h302,
because it's traditional to import and use a name directly, instead
of a whole module. This hides other errors and gives people the
impression that it's actually fine to import non-modules, you just
have to slap #noqa on those lines.
I went through the code and identified about a dozen names that are
most commonly imported this way. I remove the #noqa tag from them,
and added them to the list in import_exceptions.
I also removed a few unused imports that were revealed in the process.
Change-Id: I27afb8e2b1d4759ec974ded9464d8f010312ee78
After browser session timeout, the user is now redirected back to the previous
screen upon login.
Also added a non regression unittest.
Change-Id: I995bc217803805364967688e9b896b9b54583b36
Closes-Bug: #1201619
This patch replaces some method imports with module imports and
makes H302 test enabled.
Fixes bug 1188531
Change-Id: Ibfbddeaa19cbbb244da58ffd5c918c41f03a0c65
Currently the redirect is always made to the url of the 'login' view.
This change makes redirects go to LOGIN_URL, so the default login view
can be replaced with a view at another url/name.
Fixes bug 1079444.
Change-Id: Ib56200679668dd053d3c6ac24807d2a2affc0df8