OpenStack Dashboard (Horizon)
Go to file
Akihiro Motoki 1dd12d8deb test: Ensure to stop mock when create_mocks decorator exits
During reviewing https://review.opendev.org/c/openstack/horizon/+/772603,
we noticed that a method decorated by create_mocks is called multiple time
in a single test. Previously create_mocks decorator does not stop mocking,
so this means that multiple active mock can exist for one method.
In general, it is not a good idea to mock a method multiple times at the
same time.

To cope with this situation, this commit ensures for create_mocks decorator
to stop active mocks when exiting the decorator.

This works for most cases, but it does not work only when mocking and
assertions are handled by separate methods and test logic is placed between
them. To cope with this, "stop_mock" optional argument is introduced.

FYI: Details on why "stop_mock" is needed.
I explored various ways but could not find a good way so far.
create_mocks needs to be a decorator as it needs to refer an object
reference (self). On the other hand, if we would like to merge the logic of
mocking and assertions (for example, _stub_api_calls() and _check_api_calls()
in openstack_dashboard/dashboards/project/overview/tests.py), a context
manager would be good as we would like to call it inside a class.
However, we cannot mix a decorator and a context manger as a decorator is
executed when a context manager is iniitialized and stopping mock in
the create_mocks decorator is done during the initialization of the
context manager and methods are not mocked when test code is run.

Change-Id: I9e37dc1eaa08adf36d11975fed6f5a0a90cdde52
2021-02-26 18:44:11 +09:00
.zuul.d Consume horizon tempest test from tempest master 2021-01-21 08:34:34 +09:00
doc Imported Translations from Zanata 2021-02-18 06:55:58 +00:00
horizon Fix typo in horizon/exceptions.py 2021-02-24 17:59:35 +09:00
openstack_auth Use override_settings decorator consistently 2021-02-04 14:44:25 +09:00
openstack_dashboard test: Ensure to stop mock when create_mocks decorator exits 2021-02-26 18:44:11 +09:00
playbooks Fix ironic-ui cross job 2020-09-10 06:10:38 +00:00
releasenotes Imported Translations from Zanata 2021-02-18 06:55:58 +00:00
roles Improve integration tests logging 2020-09-04 12:46:17 +03:00
tools Fix coverage job 2020-10-05 15:32:06 +09:00
.eslintignore bump eslint version to 1.10.3 2016-03-31 14:06:45 +00:00
.eslintrc Update ESLint devDependencies in package.json 2020-12-16 12:20:10 -06:00
.gitignore [cleanup] Remove unused file refernce from .gitignore file 2020-12-08 08:57:46 +00:00
.gitreview OpenDev Migration Patch 2019-04-19 19:37:19 +00:00
.mailmap Update my mailmap 2013-10-25 14:49:23 +08:00
.pylintrc Use python3-style super() 2020-10-15 14:37:20 +09:00
CONTRIBUTING.rst [ussuri] [goal] Project PTL and contributor docs 2020-08-20 08:34:11 +09:00
HACKING.rst Update the documentation link for doc migration 2017-08-04 18:38:25 +00:00
LICENSE Initial commit 2011-01-12 13:43:31 -08:00
MANIFEST.in Update MANIFEST for dashboard config 2020-06-08 15:06:58 +02:00
README.rst Add release notes link in README 2018-07-10 14:45:26 +07:00
babel-django.cfg Drop babel extractor definitions from babel config 2019-12-23 17:25:38 +09:00
babel-djangojs.cfg Drop babel extractor definitions from babel config 2019-12-23 17:25:38 +09:00
bindep.txt Fix video recording for integration tests 2020-04-09 09:20:04 +00:00
lower-constraints.txt Bump min requirement of xstatic-jquery to 1.12.x 2021-01-20 18:06:15 +09:00
manage.py hacking: noqa cleanup in horizon 2017-03-17 19:38:47 +00:00
package.json Update devDependencies in package.json 2020-12-17 12:21:31 -06:00
plugin-registry.csv Remove retired karbor-dashboard usage 2020-12-15 16:04:11 -08:00
reno.yaml Tell reno to ignore the kilo branch 2020-03-23 13:18:58 +00:00
requirements.txt Bump min requirement of xstatic-jquery to 1.12.x 2021-01-20 18:06:15 +09:00
setup.cfg Add py38 package metadata 2020-04-24 08:22:35 -05:00
setup.py Updated from global requirements 2017-05-30 13:34:43 +00:00
test-requirements.txt Bump pylint version to support python3.8 2020-09-10 11:43:57 +09:00
test-shim.js Add Apache 2.0 license to source file 2016-12-02 17:40:28 +07:00
tox.ini Use TOX_CONSTRAINTS_FILE 2021-01-29 19:49:41 +00:00

README.rst

Horizon (OpenStack Dashboard)

Horizon is a Django-based project aimed at providing a complete OpenStack Dashboard along with an extensible framework for building new dashboards from reusable components. The openstack_dashboard module is a reference implementation of a Django site that uses the horizon app to provide web-based interactions with the various OpenStack projects.

image

Using Horizon

See doc/source/install/index.rst about how to install Horizon in your OpenStack setup. It describes the example steps and has pointers for more detailed settings and configurations.

It is also available at Installation Guide.

Getting Started for Developers

doc/source/quickstart.rst or Quickstart Guide describes how to setup Horizon development environment and start development.

Building Contributor Documentation

This documentation is written by contributors, for contributors.

The source is maintained in the doc/source directory using reStructuredText and built by Sphinx

To build the docs, use:

$ tox -e docs

Results are in the doc/build/html directory