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
This commit is contained in:
manchandavishal 2019-10-05 10:53:34 +00:00 committed by Akihiro Motoki
parent 4194644ba5
commit a0975b6198
3 changed files with 18 additions and 55 deletions

View File

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

View File

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

13
tox.ini
View File

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