Browse Source

Use Horizon project template for django jobs

Horizon defined a project template 'horizon-non-primary-django-jobs'
for django jobs. This patch use that template to run django jobs
here and also fixes failed test cases for django2.2 support.
For information please refer [1]

[1] https://review.opendev.org/#/c/681969/

Change-Id: I3ab81402633b9abe39e49c3921585db992050540
changes/86/686886/4
manchandavishal 2 years ago
committed by Akihiro Motoki
parent
commit
a0975b6198
  1. 5
      .zuul.yaml
  2. 55
      heat_dashboard/test/tests/content/test_stacks.py
  3. 13
      tox.ini

5
.zuul.yaml

@ -24,6 +24,7 @@
- project:
templates:
- check-requirements
- horizon-non-primary-django-jobs
- horizon-nodejs10-jobs
- openstack-lower-constraints-jobs
- openstack-python-jobs-horizon
@ -32,9 +33,5 @@
- release-notes-jobs-python3
check:
jobs:
- horizon-openstack-tox-python3-django111
- heat-dashboard-integration-tests:
voting: false
gate:
jobs:
- horizon-openstack-tox-python3-django111

55
heat_dashboard/test/tests/content/test_stacks.py

@ -13,7 +13,6 @@
import json
import re
import django
from django.conf import settings
from django.core import exceptions
from django.test.utils import override_settings
@ -353,23 +352,13 @@ class StackTests(test.TestCase):
self.assertTemplateUsed(res, 'project/stacks/create.html')
# ensure the fields were rendered correctly
if (1, 10) <= django.VERSION < (2, 1):
pattern = ('<input class="form-control" '
'id="id___param_public_string" '
'name="__param_public_string" type="text" required/>')
secret = ('<input class="form-control" '
'id="id___param_secret_string" '
'name="__param_secret_string" '
'type="password" required>')
else:
pattern = ('<input class="form-control" '
'id="id___param_public_string" '
'name="__param_public_string" type="text" />')
secret = ('<input class="form-control" '
'id="id___param_secret_string" '
'name="__param_secret_string" '
'type="password" />')
pattern = ('<input class="form-control" '
'id="id___param_public_string" '
'name="__param_public_string" type="text" required/>')
secret = ('<input class="form-control" '
'id="id___param_secret_string" '
'name="__param_secret_string" '
'type="password" required>')
self.assertContains(res, pattern, html=True)
self.assertContains(res, secret, html=True)
self.mock_template_validate.assert_called_once_with(
@ -511,32 +500,16 @@ class StackTests(test.TestCase):
self.assertTemplateUsed(res, 'project/stacks/create.html')
# ensure the fields were rendered correctly
if (1, 10) <= django.VERSION < (2, 1):
input_str = ('<input class="form-control" '
'id="id___param_param{0}" '
'name="__param_param{0}" type="{1}" required/>')
else:
input_str = ('<input class="form-control" '
'id="id___param_param{0}" '
'name="__param_param{0}" type="{1}"/>')
input_str = ('<input class="form-control" '
'id="id___param_param{0}" '
'name="__param_param{0}" type="{1}" required/>')
self.assertContains(res, input_str.format(3, 'text'), html=True)
self.assertContains(res, input_str.format(4, 'text'), html=True)
if (1, 11) <= django.VERSION < (2, 1):
input_str_param2 = ('<input type="number" name="__param_param2" '
'autocomplete="off" '
'required class="form-control" '
'id="id___param_param2" />')
elif (1, 10) <= django.VERSION < (1, 11):
input_str_param2 = ('<input autocomplete="off" '
'class="form-control" id="id___param_param2" '
'name="__param_param2" type="number" '
'required />')
else:
input_str_param2 = ('<input autocomplete="off" '
'class ="form-control" '
'id="id___param_param2" '
'name="__param_param2" type="number" />')
input_str_param2 = ('<input type="number" name="__param_param2" '
'autocomplete="off" '
'required class="form-control" '
'id="id___param_param2" />')
self.assertContains(res, input_str_param2, html=True)
# post some sample data and make sure it validates

13
tox.ini

@ -1,5 +1,5 @@
[tox]
envlist = py27,py36,py37,py3-dj111,pep8,releasenotes
envlist = py27,py36,py37,py3-{dj111,dj22},pep8,releasenotes
minversion = 2.5.0
skipsdist = True
@ -16,10 +16,9 @@ setenv =
deps = -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = {[unit_tests]commands}
[unit_tests]
commands =
dj111: pip install django>=1.11,<2
dj22: pip install django>=2.2,<2.3
python manage.py test heat_dashboard.test --settings=heat_dashboard.test.settings --exclude-tag integration
[testenv:integration]
@ -49,12 +48,6 @@ commands =
coverage xml
coverage html
[testenv:py3-dj111]
basepython = python3
commands =
pip install django>=1.11,<2
{[unit_tests]commands}
[testenv:docs]
basepython = python3
deps = -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}

Loading…
Cancel
Save