Stub out basic plugin folder layout

This change add a basic folder structure for
the plugin.
In the src tree the following folders are created

views: the django application views
api: the apis exposed to the the views
datasource: a module to encapsulate how data is retrived
static: static content including any javascript
templates: django templates

the tests folder are extened to also add functional
tests.

unit tests test indiviual functions within a single module
mocking most of there depencies. i.e. any calls into horizon.

functional tests will prefer less mocks allowing more complciate
logic but will not requrie an external web server to host the
plugin.

later cypress tests will be added to test end to end functionaltiy.

The atoms of the plugin shoudl be tested with unit tests
The workflows and over all logic with funtional tests
The end to end functionality with cypress tests.

each will build on each other with more complexity
but getting closer and closer to the end user workflow.

While the cypress tests will likely use the fake datasouce
it will not use any mocking.

Change-Id: I091d42c669f8320c6eee2d13bfc6abdde3d27d5c
This commit is contained in:
Sean Mooney
2025-05-20 11:22:16 +00:00
parent 8346769c9b
commit 0cbf755602
17 changed files with 67 additions and 2 deletions
+2
View File
@@ -8,6 +8,8 @@
check:
jobs:
- openstack-tox-pep8
- openstack-tox-functional
gate:
jobs:
- openstack-tox-pep8
- openstack-tox-functional
+2
View File
@@ -0,0 +1,2 @@
#
# SPDX-License-Identifier: Apache-2.0
+2
View File
@@ -0,0 +1,2 @@
#
# SPDX-License-Identifier: Apache-2.0
+2
View File
@@ -0,0 +1,2 @@
#
# SPDX-License-Identifier: Apache-2.0
+2
View File
@@ -0,0 +1,2 @@
#
# SPDX-License-Identifier: Apache-2.0
@@ -0,0 +1,2 @@
#
# SPDX-License-Identifier: Apache-2.0
+2
View File
@@ -0,0 +1,2 @@
#
# SPDX-License-Identifier: Apache-2.0
+2
View File
@@ -0,0 +1,2 @@
#
# SPDX-License-Identifier: Apache-2.0
View File
View File
+2
View File
@@ -0,0 +1,2 @@
#
# SPDX-License-Identifier: Apache-2.0
@@ -0,0 +1,2 @@
#
# SPDX-License-Identifier: Apache-2.0
+8
View File
@@ -0,0 +1,8 @@
#
# SPDX-License-Identifier: Apache-2.0
from django import test
class TestCase(test.SimpleTestCase):
pass
@@ -0,0 +1,7 @@
#
# SPDX-License-Identifier: Apache-2.0
from horizon.test.settings import * # noqa
from openstack_dashboard.test.settings import * # noqa
DEBUG = True
@@ -0,0 +1,10 @@
#
# SPDX-License-Identifier: Apache-2.0
from grian_ui import main
from grian_ui_tests.unit import base
class MainTests(base.TestCase):
def test_message(self):
self.assertEqual("hi", main.message())
+4
View File
@@ -1,2 +1,6 @@
#
# SPDX-License-Identifier: Apache-2.0
# our unit tests should not need to depend on horizon.
DEBUG = True
+18 -2
View File
@@ -23,7 +23,6 @@ setenv =
# this is required to make the tests available
# as they are not part of the package.
PYTHONPATH = {toxinidir}/tests:{envdir}
DJANGO_SETTINGS_MODULE=grian_ui_tests.unit.settings
deps =
-r requirements.txt
-r{toxinidir}/test-requirements.txt
@@ -65,10 +64,25 @@ commands =
pre-commit run --all-files --show-diff-on-failure
[testenv:{unit,py3,py310,py311,py312,py313}]
description =
Run granular unit tests without horizon.
set_env =
{[testenv]setenv}
DJANGO_SETTINGS_MODULE=grian_ui_tests.unit.settings
[testenv:functional{,-py310,-py311,-py312,-py313}]
description =
Run higher level functional tests with horizon.
set_env =
{[testenv]setenv}
DJANGO_SETTINGS_MODULE=grian_ui_tests.functional.settings
commands =
stestr --test-path={toxinidir}/tests/grian_ui_tests/functional run {posargs}
stestr slowest
[testenv:venv]
description =
A virtual env with all deps installed.
deps =
{[testenv]deps}
-r{toxinidir}/doc/requirements.txt
@@ -76,6 +90,8 @@ commands =
{posargs}
[testenv:releasenotes]
description =
Generate Release notes.
deps =
{[testenv]deps}
-r{toxinidir}/doc/requirements.txt
@@ -83,7 +99,7 @@ commands = sphinx-build -a -W -E -d releasenotes/build/doctrees -b html releasen
[testenv:docs]
description =
Build all documentation including API guides and refs.
Build all documentation as html.
deps = -r{toxinidir}/doc/requirements.txt
commands =
rm -rf doc/build