Commit Graph

53 Commits

Author SHA1 Message Date
Takashi Kajinami bced896d37 Remove workaround for old django-pyscss
This reverts the change[1] made earlier to workaround the issue caused
by usage of vendored version of six library in the django-pyscss
library.

The django-pyscss library no longer imports the vendored version of
six, since 2.0.3[2].

[1] 39f28ad5ed
[2] 1499332e1d

Change-Id: I22802b75d6a8d8f35930709e89d64dd65982cef0
2024-02-02 03:23:43 +09:00
Akihiro Motoki 39f28ad5ed Preparation for Django 3.0 and 3.1 support (2)
django-pyscss is not compatible with Django 3.0.
django_pyscss_fix is a temporary workaround for django.utils.six
used in django-pyscss. It also add six in requirements.txt
as we use six module for this workaround.
This is just to run horizon for testing with Django 3.0+.

six is re-added to requirements.txt as it is used in the workaround.
Note that other codes in the horizon repo should not depend on six.

Change-Id: If79289b7518dd8eaf292a90d6fb790beb154cb7c
2021-09-16 16:16:12 +09:00
Akihiro Motoki a7b25f0cc4 Fix pep8 failures with hacking 2.0.0
It seems hacking 2.0.0 was shipped with incompatible changes
(which is not surprising as this is a new major version).
Let's fix these errors and use a newer hacking.

Change-Id: I8da9dca5d8d74f6dfc2340dabc8d50e6253358e2
2019-12-17 04:55:05 +00:00
Akihiro Motoki 9b99f17100 Define default settings explicitly (horizon)
test_parse_isotime_filter in test_filters is updated to match
TIME_ZONE=UTC. Previously TIME_ZONE was not set in horizon.test.settings
and the default value America/Chicago was used. Horizon uses UTC as the
default value of TIME_ZONE, so it is better to use UTC for testing too.

horizon settings in openstack_dashboard.settings are moved to
under horizon.

Part of blueprint ini-based-configuration
Change-Id: I9abdbbe0dcefc08ffea61143e3c0a87ed87b2e2a
2019-09-12 15:05:56 +09:00
Akihiro Motoki e56e076ea8 Define default settings explicitly (openstack_auth)
This commit also moves descriptions of settings defined in openstack_auth
from openstack_dashboard/settings.py and local_settings.py(.example)
to openstack_auth/settings.py.

Note that if openstack_dashboard has different default settings
from openstack_auth defaults, they are now moved to
openstack_dashboard/defaults.py.

Part of blueprint ini-based-configuration
Change-Id: I59eebc388de0bcbd4d1fe35c6138efbd3e04c5b8
2019-09-12 15:05:56 +09:00
Akihiro Motoki 28b457bc62 UT: Detect template rendering errors
This commit enables template debug option to detect errors
in template rendering in unit tests.

Several errors in template rendering are found by enabling the
debug option and they are fixed in this commit.

Related-Bug: #1809983
Change-Id: I1a2d19f2eae62e16f02d3386abd65527bac4e7a0
2019-01-31 21:29:33 +09:00
Mathieu Gagné 0d16361326 Fix django.contrib.auth.middleware monkey patching
The "request" attribute is not available in
openstack_auth.backend.KeystoneBackend.get_user when session data is restored
and it's the first request to happen after a server restart.

As stated by the function document, the "request" attribute needs to be
monkey-patched by openstack_auth.utils.patch_middleware_get_user
for this function to work properly.

This should happen in openstack_auth.urls at import time. But there is nowhere
in Horizon where this module is imported at startup. It's only introspected
by openstack_dashboard.urls due to AUTHENTICATION_URLS setting.

Without this monkey-patching, the whole authentication mechanism falls back
to "AnonymousUser" and you will get redirected to the login page due
to horizon.exceptions.NotAuthenticated being raised by
horizon.decorators.require_auth as request.user.is_authenticated will be False.

But if a user requests a page under auth/, it will have the side-effect of
monkey-patching django.contrib.auth.middleware as expected. This means that
once this request is completed, all following requests to pages other than
the ones under auth/ will have there sessions properly restored and
you will be properly authenticated.

Therefore this change introduces a dummy middleware which sole purpose is
to perform this monkey-patching as early as possible.

There is also some cleanup to get rid of the previous attempts at
monkeypatching.

Closes-bug: #1764622
Change-Id: Ib9912090a87b716e7f5710f6f360b0df168ec2e3
2018-11-06 21:36:45 +00:00
Ivan Kolodyazhny 770afab1bf Remove nose references from Horizon
Commit I7fb2fd7dd40f301ea822154b9809a9a07610c507 changed test runner to
not use nose. So it's safe to remove all references now.

Change-Id: I8856e4e91b25f059645eb5e0356d207f6fc119f2
2018-09-22 20:11:30 +03:00
Ivan Kolodyazhny 1f80d94459 Use default Django test runner instead of nose
Nose has been in maintenance mode for the past several years. It has
issue with exit code [1] which leads to false positive results for our
seleniun-headless job.

This patch changes test runner for Horizon tests and does the following
things:

* Django test runner  executes test in a different order than Nose does.
  That's why we've got an issue with side-effect in
  horizon.tests.unit.tables.test_tables.MyToggleAction class. This patch
  adds workaround to it.
* Rename filename of test files to names starting with 'test_'
  so that the django test runner can find tests expectedly.
* '--with-html-output' option is temporary dropped and will be added in
  a following patch.
* Integraion tests is marked via django.test.tag mechanism which is
  introduced in Django 1.10
* 'selenium-headless' is broken now because we don't have geckodriver on
  gates, this patch makes it non-voting.
* 'tox -e cover' is fixed
* Remove @memorized decorator from
  dashboards.project.images.images.tables.filter_tenant_ids function.

[1] https://github.com/nose-devs/nose/issues/984

Depends-On: https://review.openstack.org/572095
Depends-On: https://review.openstack.org/572124
Depends-On: https://review.openstack.org/572390
Depends-On: https://review.openstack.org/572391

Related blueprint: improve-horizon-testing
Change-Id: I7fb2fd7dd40f301ea822154b9809a9a07610c507
2018-06-08 15:21:12 +03:00
Akihiro Motoki 3ecda5ac67 django2: adopt New-style middleware
Django 1.10 introduces a new style of middleware and
the old style was removed in Django 2.0.

https://docs.djangoproject.com/en/2.0/releases/1.10/#new-style-middleware

blueprint django2-support
Change-Id: I2fba2b1b2b528096422df3ed558ad75a1b80bbb9
2018-03-03 07:22:35 +09:00
Akihiro Motoki be197d11f1 django2: Drop SessionAuthenticationMiddleware
https://docs.djangoproject.com/en/2.0/releases/2.0/#miscellaneous
---
The SessionAuthenticationMiddleware class is removed. It provided
no functionality since session authentication is unconditionally
enabled in Django 1.10.
---

blueprint django2-support
Change-Id: I2767e01ec8879d6886152a0ed67f6738eb17209c
2018-03-03 07:22:35 +09:00
Thomas Bechtold 8d7b2ce3c0 Make nosehtmloutput an optional test requirement
It is not strictly needed.

Change-Id: I37b2623ec834533a7ecae63084e2c2c04ecc1751
2017-08-21 15:25:44 +02:00
Akihiro Motoki 65951cf1b9 Generate unit test HTML reports
Currently we need to check unit test results by opening console.html.
HTML reports would be nice for this purpose.

Note that the infra CI post script stores '*nose_results.html',
so the filenames need to end with 'nose_results.html'.

--with-html-output option is not available for python 3. I am not sure
the reason at now, but I think it is worth enabling it for python 2.

Change-Id: Icea8d21d0cf93f99f577e6609e9ced166a55609a
2017-05-04 07:23:40 +00:00
Rob Cresswell 3488ab3d40 Fix compatibility issues with Django 1.10
Required modifying our URL pattern decorator to
be compatible with the slightly different callback
attribute mechanism in 1.10

Modified breadcrumb structures to always be 2-tuples
as tuple unpacking is now strictly enforced in 1.10

Also made the following things changed in Django 1.10.
- fixed the now-deprecated TEMPLATE_DEBUG.
- Caught up with Request context change
- SimpleTestCase.urls is removed in 1.10.
  ROOT_URLCONF needs to be used instead.

Co-Authored-By: Richard Jones <r1chardj0n3s@gmail.com>
Co-Authored-By: Akihiro Motoki <motoki@da.jp.nec.com>
Change-Id: I59cbd8bff117813258539ed0724fe89a9f5b77ee
Implements: blueprint dj110
2016-09-20 12:29:16 +01:00
Richard Jones 348069364c Re-work static_settings to clean up
This patch reduces duplication arbitrary directory choices for
xstatic package locations in the static directory.

It moves the xstatic configuration from the library into the
settings file, and the supporting functions move to
the openstack_dashboard.utils.settings module. Having the xstatic
module list in settings allows deployers to add new modules.

It standardises the paths the files are served from, reducing
potential conflicts.

It simplifies the interaction with the xstatic modules, and also uses
the new MAIN variable if present to determine the entry points used.

Since some of the xstatic packages were installed into special
snowflakes directories (not following a pattern) the references to
those (bootstrap_scss and font_awesome) have been fixed.

Change-Id: Ia5be0e96fff1a4ddd6058d6b030ddf96da4b46e7
2016-08-18 16:28:57 +03:00
Thai Tran b2d7322e56 Panel static finder
We are only able to store static content at the dashboard (app) level.
This forces us to store all of our statics under the dashboard's static folder.

This patch introduces a panel static finder. Django's static finder will now
find files inside the panel's static folder as well. This is more inline with what
we have today for python plugins.

Change-Id: I2bb3f78abf8854dbad8f1697d942f94d36014d41
Closes-Bug: #1544295
2016-06-01 02:14:17 +00:00
Rob Cresswell fd92d8ec59 Fix remaining Django 1.9 test failures
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
2016-04-09 11:13:16 +00:00
Rob Cresswell 83c9e3fead Remove all pre-Django 1.8 workarounds
This patch removes all code workarounds in Horizon for Django versions
before 1.8. As a bonus, this means an extra unit test is run that was
previously skipped.

Change-Id: I63f56953d9beefd3ea596d3e31c6032e936b140c
Partially-Implements: blueprint drop-dj17
2016-01-24 22:12:02 +00:00
Thomas Goirand b9cfe4d200 [Django 1.9] Do not use django.utils.log.NullHandler
django.utils.log.NullHandler is removed from Django 1.9, this patch
uses logging.NullHandler instead.

Change-Id: I940e72468400fde85342c44f55cce5f5e2a3c66e
Closes-Bug: 1534526
Partially-Implements: blueprint drop-dj17
2016-01-18 15:11:25 +00:00
lin-hua-cheng 1f19522a85 Add optional Report Bug link to Horizon
Change-Id: I2d0053adbdfcb196683c709f755f778427e6109b
Closes-Bug: #1499476
2015-09-25 17:29:15 -07:00
Richard Jones 7a3d5be9bc Fix the selenium LazyLoadedTabsTests
These tests were broken when we removed Javascript loading
from the test base.html during the ngReorg. A minimal set
of Javascript and configuration has been re-added.

Also note that the loadAngular function from the tech-debt
utils service has been moved into the only place it's
used to reduce configuration overhead.

Partial-Bug: #1475387
Change-Id: If5472e93d7941608479b430512fc79c1fdb3407c
2015-08-31 01:52:00 +00:00
David Lyle 33042c48fb Fixing gate bug with new requirements
Change-Id: Ib597a6dd421f28343ee883dd78e3d4bf1ba77841
2015-05-01 11:54:44 -06:00
Doug Fish 3531d7bb9a Revert "Refactoring the exceptions lists"
This reverts commit 7fc1baad3a.

Change-Id: I495e76eea8c873d71b37625b0953d821156c599c
Closes-Bug: 1440903
2015-04-06 16:49:17 -05:00
George Peristerakis 7fc1baad3a Refactoring the exceptions lists
The exception list is not properly used. The exception list is a
settings constant that can be modified within the settings file.  Having
the list in openstack_dashboard/exceptions.py confuses the
developers. The list of exceptions are moved in the settings file and
removed all duplications.

Partially Implements: blueprint improve-error-message-details-for-usability
Change-Id: I5e19c3f0b84b17fa28f6e3c113467cc19d9b0a03
2015-04-01 15:00:30 -04:00
David Lyle 18dddd97da Fixing changing WEBROOT from /
There were a few items missed with the patch enabling changing
WEBROOT patch.

First the XStatic files were being unpacked in the wrong directoy
because root_url was not being passed in. This caused 404 errors
when running with a different web root.

This change allows root_url to be passed in on XStatic handling.

Second, STATIC_URL and MEDIA_URL were not using WEBROOT.
These now are built with WEBROOT.

Third, the fa-font-path variable was hard-coded in _variables.scss
to use "/" as the web root.

A webroot variable has been added that can be overridden. Additionally,
a new theme has also been added to change the web root.

Closes-Bug: #1434276
Change-Id: Ifff1c60b3405ce2136d039b8d74da08752e7215c
2015-03-23 13:47:22 -06:00
Matthias Runge e77dfcab4c Add Django-1.7 support
And add initial Django-1.8 fixes

- skip unittests until exceptions are fixed
- Django-1.8 changed the way TemplateLoaders are initialized.
- django.middleware.doc.XViewMiddleware is removed.
- SessionAuthenticationMiddleware was added and will be mandatory for
  Django-2.0

Closes-Bug: #1425892
Partially Implements: blueprint django18

Change-Id: Idfd3f494db7b11a66e2262c9520be88b098fbb7b
2015-03-18 08:42:10 +01:00
Radomir Dopieralski 972c6a8e2f Separate static_settings.py from settings.py
The packagers will most likely need to replace the configuration
for the locations of all the static files when packaging for their
distributions. It's much more convenient for them, when that
configuration is in a separate file.

Change-Id: I346687f4592b97f9c15a20e09fd0e1e80bd1918d
Partial-implements: blueprint static-file-bower
2015-01-15 09:23:59 +01:00
Richard Jones d7df6378a3 Add new angular dependencies to requirements.txt
These dependencies allow tighter integration between bootstrap and angular,
and a much cleaner, flexible and feature-rich framework for handling tabular
data.

Changes in this version:

- updated smart-table to 1.4.5.2 to re-work contents of package
- added angular bootstrap 0.11.0.2

Partially Implemenents: blueprint angularize-identity-tables

Change-Id: Ia1c2df26fd89ae5e3eae1f87e18329d12b281841
2015-01-09 15:26:59 -07:00
Travis Tripp 581112f6d1 Cleanup angular 1.2.1.1 dependencies
Adding version 1.3.7

1.3.x angular is needed for Horizon launch instance work.

This was dependent on the following (done):
https://review.openstack.org/#/c/142520/
Xstatic-Angular 1.3.7 includes the following packages:
XStatic-Angular-Cookies
XStatic-Angular-Mock

They can be removed, but this apparently needs to be done
in a multi-step process. The interdependency chain,
(horizon has dependency on the old packages) causes
an integration test to fail. So, if we follow the normal
process, then we have to do it in the following order.
1) The newer pakage has to be added to global requirements
2) a) The new dependency has to be added to Horizon
   b) Old dependencies must be removed from Horizon
3) The older packages must be removed from global requirements
   - change 145096

Note: This patch includes the 1.3.7 dependency update, but
that will be handled by the auto update when global requirements
is merged and this should rebase automatically on top of that.

Partially Implements: blueprint launch-instance-redesign

Change-Id: I83770224dd6b8df2da4e5cb2efaa3ec932b6e4a1
2015-01-08 08:34:03 -07:00
Akihiro Motoki 5dfca25190 Fix E128 errors in horizon/
E128 continuation line under-indented for visual indent

Partial-Bug: #1375929
Change-Id: If4cc09995a74b68a6b037ea8999cebe09c750e65
2014-10-15 13:50:07 +09:00
Jenkins 29215e349b Merge "Unbundle bootstrap and use xstatic version" 2014-10-02 05:12:59 +00:00
Radomir Dopieralski 9e37a00ee9 Unbundle bootstrap and use xstatic version
This uses the xstatic-packaged versions of bootstrap and bootstrap-datepicker.
It requires newer versions of pyscss and django-pyscss, as there were some
bugs in there that were just fixed upstream.

Change-Id: I0a7660d29fecde915eb46916453a9ea96296798d
Implements: bluperint remove-javascript-bundling
Closes-bug: #1375883
2014-09-30 18:46:47 +02:00
Radomir Dopieralski b361738bd3 Upgrade and unbundle jquery-ui
Upgrade jquery-ui to >=1.10.1 and unbundle it to an xstatic package.

Since versions 1.10 and 1.11 use different directory structure, there is
a small conditional in the settings, using different paths depending on
the version.

Change-Id: If5116ec33cdb31b045d5c1c21b9640b38ff05f5e
Closes-bug: #1367720
Blueprint: remove-javascript-bundling
2014-09-25 10:20:54 +02:00
Randy Bertram 6849481c42 Switch to xstatic-bootstrap-datepicker
This points to datepicker 1.3.1 in xstatic.
Also fixes a couple of minor bugs in forms with
the new datepicker. The datepicker patch is:
https://review.openstack.org/#/c/116866/

Change-Id: I0a8cb7a16e50addbbdb10df8bdd4be427937bd81
Closes-Bug: 1361666
2014-09-11 13:26:11 -04:00
Radomir Dopieralski f7cc64bb0f Add Font Awesome icons
This patch adds an xstatic-packaged font awesome icon font to Horizon.
We need it, because the font icons included in Bootstrap 3 are non-free
and are likely to be excluded from some distributions. It also has a much
richer set of icons to choose from.

Change-Id: I725e0d77d230c16c01971f9af0dc02eb5662154d
Partial-implements: blueprint bp/font-icons
2014-09-02 12:51:42 +02:00
Radomir Dopieralski 210717a43d Unbundle all JavaScript libraries from Horizon
Remove all external JS libraries from Horizon, and pull them in as
xstatic packages instead.

Bootstrap, jquery-ui and jquery.bootstrap.wizard will be unbundled in separate
patches, as there are some problems adding them to global-requirements.

Partial-Implements: blueprint remove-javascript-bundling
Change-Id: Icbbcf8e58db2dcce96d187f7307201f728812cd2
2014-08-19 09:59:12 +02:00
Thomas Goirand daf9e5c772 TEMPLATE_DIRS must be a tuple
With Django 1.7, TEMPLATE_DIRS must be a tuple. The
definition in horizon/test/settings.py must therefore
have a leading comma. Note that other definitions of
TEMPLATE_DIRS are already like this in Horizon, so
this just fixes the one instance which is wrong.

Change-Id: I4d9aa9e716e4cf6c2b56fd25ab8fde9187fc5108
2014-08-03 18:35:54 +08:00
Pawel Skowron 791f384e3e Fix Flake8 style warnings in horizon/
Warnings H904, H307 and H405 are new or considerably changed, and will
be fixed in a separate patch.

Partial-bug: #1347472

Change-Id: Id9325a40d443f77242d3634002789501afbfc35a
Co-Authored-By: Juan M. Olle <juan.m.olle@intel.com>
2014-07-29 20:38:49 +00:00
Radomir Dopieralski 802caf23d7 Unbundle jquery from horizon using xstatic
Instead of bundling the jquery.js code with horizon,
we use the xstatic and xstatic-jquery s dependencies
that provide us with the packaged files.

This patch partially implements blueprint remove-javascript-bundling
Further patches will follow.

Change-Id: I395f1c64f2341d4d6847d4f7e648d6c03eb85988
2014-07-01 10:03:15 +02:00
Jenkins 90474517de Merge "Allow extensions to add Angular modules" 2014-05-30 11:45:02 +00:00
Jenkins 5c684a2a49 Merge "Patch Django 1.4 on Python 2.7.4 or greater" 2014-05-30 08:10:58 +00:00
Rob Raymond b3aec6b1d3 Allow extensions to add Angular modules
This change allows extension plugins to make use of AngularJS without
changing horizon template or javascript files.
Horizon bootstraps AngularJS once when a page loads with a list
of modules. An extension can register a list of modules and a list
of javascript files that contain these modules.

Implements blueprint: plugins-angular
Change-Id: I4a76363dd4a631cc0d2fc2c902c2f5cac0f073f2
2014-05-28 15:58:39 -06:00
He Yongli e790ac070e Remove extraneous vim configuration comments
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
2014-05-06 15:30:10 +08:00
Peter Belanyi b4934d17e0 Patch Django 1.4 on Python 2.7.4 or greater
This fix provides a patch for Django 1.4 to get rid of
the issues with django.test.assertContains in the py27dj14
test environment.

Change-Id: I4c7a225ef1095999f7c109e77c95e1a6fe04db8c
Closes-Bug: #1273943
2014-04-30 17:16:44 +02:00
Jenkins e543879af6 Merge "Enabled django-compressor for javascript sanity test" 2013-11-13 17:35:14 +00:00
Akihiro MOTOKI 1f81be7e67 Add logging configuration for iso8601 module
iso8601 module outputs log messages but it is not useful for users,
so this commit assigns null log handler to iso8601 module.
This change suppresses iso8601 log messages during unit tests.

Also moves openstack_dashboard related logging config for unit test
from horizon to openstack_dashboard.

Change-Id: I01cf12688118e2137382b8dc7a050b3587749354
Closes-Bug: #1250554
2013-11-13 05:18:08 +09:00
George Peristerakis 3fd7f426a4 Enabled django-compressor for javascript sanity test
By default the test did not run with the compressor on
which did load the javascript. There's no way to test errors
compressing the javascript.

Fix bug #1187576

Change-Id: I1db226ae9709ff818e8d13b7935ded66c0f6eae3
2013-11-07 10:12:51 -05:00
Akihiro MOTOKI a2d6c1f143 Remove test string from translation files
Closes-Bug: #1221123

Removing unnecessary translation strings reduces translation work.
String Freeze is enabled so this patch also update en PO files.

Change-Id: Ie69c8d0b990e53678262457094852b1ef4966b8b
2013-09-06 15:56:06 +09:00
Tatiana Mazur 953d1b9793 Enable H302 check
This patch replaces some method imports with module imports and
makes H302 test enabled.

Fixes bug 1188531

Change-Id: Ibfbddeaa19cbbb244da58ffd5c918c41f03a0c65
2013-08-22 17:39:09 +04:00
Mark McClain 84e054b200 update Quantum references to Neutron
implements bug: 1197208

Change-Id: I14de163ca3cf498f5cb738a4c09088bba1759488
2013-07-09 17:51:54 -04:00