Add unit test and coverage configuration
Change-Id: Id57bb2ee92483adc1751a45a6d4c1f320a900591
This commit is contained in:
parent
c8a8a1b35b
commit
0d14b0dd33
|
@ -0,0 +1,6 @@
|
|||
[run]
|
||||
branch = True
|
||||
source = cuedashboard
|
||||
|
||||
[report]
|
||||
ignore-errors = True
|
|
@ -4,8 +4,21 @@ vagrant/
|
|||
AUTHORS
|
||||
ChangeLog
|
||||
.DS_Store
|
||||
cue_dashboard.egg*
|
||||
cuedashboard.egg*
|
||||
build/
|
||||
.tox/
|
||||
.eggs/
|
||||
.idea/
|
||||
cover/
|
||||
*.lock
|
||||
.secret_key_store
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.testrepository/
|
||||
.coverage
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
[DEFAULT]
|
||||
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
|
||||
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
|
||||
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
|
||||
${PYTHON:-python} -m subunit.run discover -t ./ ./cuedashboard/tests/ $LISTOPT $IDOPTION
|
||||
test_id_option=--load-list $IDFILE
|
||||
test_list_option=--list
|
|
@ -1,12 +1,18 @@
|
|||
###############################################################################
|
||||
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
|
||||
# Copyright 2015 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# This software is the confidential and proprietary information of Hewlett
|
||||
# Packard Company. ("Confidential Information"). You shall not
|
||||
# disclose such Confidential Information and shall use it only in
|
||||
# accordance with the terms of the license agreement you entered into
|
||||
# with Hewlett-Packard.
|
||||
###############################################################################
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# Copyright [2014] Hewlett-Packard Development Company, L.P.
|
||||
# limitations under the License.
|
||||
|
||||
PANEL = 'queues'
|
||||
PANEL_GROUP = 'queuesgroup'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2014 Hewlett-Packard Development Company, L.P.
|
||||
# Copyright 2015 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Authors: Steve Leon <kokhang@gmail.com>
|
||||
#
|
||||
|
@ -16,12 +16,13 @@
|
|||
# Copyright [2014] Hewlett-Packard Development Company, L.P.
|
||||
# limitations under the License.
|
||||
|
||||
from django.conf import settings
|
||||
from cueclient.v1 import client
|
||||
from keystoneclient import session as ksc_session
|
||||
from keystoneclient.auth.identity import v2
|
||||
from openstack_dashboard import api
|
||||
|
||||
from django.conf import settings
|
||||
from horizon.utils.memoized import memoized # noqa
|
||||
from keystoneclient.auth.identity import v2
|
||||
from keystoneclient import session as ksc_session
|
||||
from openstack_dashboard import api
|
||||
|
||||
|
||||
@memoized
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2014 Hewlett-Packard Development Company, L.P.
|
||||
# Copyright 2015 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Authors: Steve Leon <kokhang@gmail.com>
|
||||
#
|
||||
|
@ -16,11 +16,12 @@
|
|||
# Copyright [2014] Hewlett-Packard Development Company, L.P.
|
||||
# limitations under the License.
|
||||
|
||||
from django.utils.translation import ungettext_lazy
|
||||
from django.utils.translation import ugettext as _
|
||||
from horizon import tables
|
||||
from cuedashboard import api
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import ungettext_lazy
|
||||
from horizon import tables
|
||||
|
||||
|
||||
class CreateCluster(tables.LinkAction):
|
||||
name = "create"
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
# Copyright 2015 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# Copyright [2014] Hewlett-Packard Development Company, L.P.
|
||||
# limitations under the License.
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from horizon import tabs
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2014 Hewlett-Packard Development Company, L.P.
|
||||
# Copyright 2015 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Authors: Steve Leon <kokhang@gmail.com>
|
||||
#
|
||||
|
@ -16,9 +16,10 @@
|
|||
# Copyright [2014] Hewlett-Packard Development Company, L.P.
|
||||
# limitations under the License.
|
||||
|
||||
from cuedashboard.queues import views
|
||||
|
||||
from django.conf.urls import patterns
|
||||
from django.conf.urls import url
|
||||
from cuedashboard.queues import views
|
||||
|
||||
|
||||
CLUSTERS = r'^(?P<cluster_id>[^/]+)/%s$'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2014 Hewlett-Packard Development Company, L.P.
|
||||
# Copyright 2015 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Authors: Steve Leon <kokhang@gmail.com>
|
||||
#
|
||||
|
@ -20,6 +20,7 @@ from cuedashboard import api
|
|||
from cuedashboard.queues.tables import ClusterTable
|
||||
from cuedashboard.queues.tabs import ClusterDetailTabs
|
||||
from cuedashboard.queues import workflows as cue_workflows
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from horizon import tables
|
||||
|
|
|
@ -12,23 +12,25 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
import json
|
||||
import logging
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.forms import ValidationError
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from horizon import exceptions
|
||||
from horizon import forms
|
||||
from horizon.utils import memoized
|
||||
from horizon.utils import validators
|
||||
from horizon import workflows
|
||||
from openstack_dashboard import api
|
||||
from oslo.utils import importutils
|
||||
|
||||
from cuedashboard.api import cluster_create
|
||||
|
||||
from openstack_dashboard.dashboards.project.instances \
|
||||
import utils as instance_utils
|
||||
instance_utils = importutils.import_module(
|
||||
"openstack_dashboard.dashboards.project.instances.utils")
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -57,19 +59,19 @@ class PasswordMixin(forms.SelfHandlingForm):
|
|||
class SetInstanceDetailsAction(workflows.Action):
|
||||
name = forms.CharField(max_length=80, label=_("Cluster Name"))
|
||||
flavor = forms.ChoiceField(label=_("Flavor"),
|
||||
help_text=_("The amount of RAM and CPU included \
|
||||
in each node of the cluster."))
|
||||
help_text=_("The amount of RAM and CPU included"
|
||||
" in each node of the cluster."))
|
||||
size = forms.IntegerField(label=_("Cluster Size"),
|
||||
min_value=1,
|
||||
initial=1,
|
||||
help_text=_("The number of nodes that make up \
|
||||
the cluster."))
|
||||
help_text=_("The number of nodes that make up "
|
||||
"the cluster."))
|
||||
network = forms.ChoiceField(label=_("Network"),
|
||||
help_text=_("Network to attach to the \
|
||||
cluster."))
|
||||
help_text=_("Network to attach to the "
|
||||
"cluster."))
|
||||
username = forms.CharField(max_length=80, label=_("User Name"),
|
||||
help_text=_("User name for logging into the \
|
||||
RabbitMQ Management UI."))
|
||||
help_text=_("User name for logging into the "
|
||||
"RabbitMQ Management UI."))
|
||||
password = forms.RegexField(
|
||||
label=_("Password"),
|
||||
widget=forms.PasswordInput(render_value=False),
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2014 Objectif Libre
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from horizon.test.settings import * # noqa
|
||||
from horizon.utils import secret_key as secret_key_utils
|
||||
from openstack_dashboard import exceptions
|
||||
|
||||
|
||||
TEST_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
ROOT_PATH = os.path.abspath(os.path.join(TEST_DIR, ".."))
|
||||
|
||||
SECRET_KEY = secret_key_utils.generate_or_read_from_file(
|
||||
os.path.join(TEST_DIR, '.secret_key_store'))
|
||||
ROOT_URLCONF = 'openstack_dashboard.urls'
|
||||
TEMPLATE_DIRS = (
|
||||
os.path.join(TEST_DIR, 'templates'),
|
||||
)
|
||||
|
||||
TEMPLATE_CONTEXT_PROCESSORS += (
|
||||
'openstack_dashboard.context_processors.openstack',
|
||||
)
|
||||
|
||||
INSTALLED_APPS = (
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.humanize',
|
||||
'django_nose',
|
||||
'openstack_auth',
|
||||
'compressor',
|
||||
'horizon',
|
||||
'openstack_dashboard',
|
||||
'openstack_dashboard.dashboards.project',
|
||||
'openstack_dashboard.dashboards.admin',
|
||||
'openstack_dashboard.dashboards.settings',
|
||||
)
|
||||
|
||||
AUTHENTICATION_BACKENDS = ('openstack_auth.backend.KeystoneBackend',)
|
||||
|
||||
SITE_BRANDING = 'OpenStack'
|
||||
|
||||
HORIZON_CONFIG = {
|
||||
'dashboards': ('project', 'admin',),
|
||||
'default_dashboard': 'project',
|
||||
"password_validator": {
|
||||
"regex": '^.{8,18}$',
|
||||
"help_text": _("Password must be between 8 and 18 characters.")
|
||||
},
|
||||
'user_home': None,
|
||||
'help_url': "http://docs.openstack.org",
|
||||
'exceptions': {'recoverable': exceptions.RECOVERABLE,
|
||||
'not_found': exceptions.NOT_FOUND,
|
||||
'unauthorized': exceptions.UNAUTHORIZED},
|
||||
'angular_modules': [],
|
||||
'js_files': [],
|
||||
}
|
||||
|
||||
# Set to True to allow users to upload images to glance via Horizon server.
|
||||
# When enabled, a file form field will appear on the create image form.
|
||||
# See documentation for deployment considerations.
|
||||
HORIZON_IMAGES_ALLOW_UPLOAD = True
|
||||
|
||||
AVAILABLE_REGIONS = [
|
||||
('http://localhost:5000/v2.0', 'local'),
|
||||
('http://remote:5000/v2.0', 'remote'),
|
||||
]
|
||||
|
||||
OPENSTACK_KEYSTONE_URL = "http://localhost:5000/v2.0"
|
||||
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "_member_"
|
||||
|
||||
OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True
|
||||
OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = 'test_domain'
|
||||
|
||||
OPENSTACK_KEYSTONE_BACKEND = {
|
||||
'name': 'native',
|
||||
'can_edit_user': True,
|
||||
'can_edit_group': True,
|
||||
'can_edit_project': True,
|
||||
'can_edit_domain': True,
|
||||
'can_edit_role': True
|
||||
}
|
||||
|
||||
OPENSTACK_HYPERVISOR_FEATURES = {
|
||||
'can_set_mount_point': True,
|
||||
'can_set_password': True,
|
||||
}
|
||||
|
||||
LOGGING['loggers']['openstack_dashboard'] = {
|
||||
'handlers': ['test'],
|
||||
'propagate': False,
|
||||
}
|
||||
|
||||
SECURITY_GROUP_RULES = {
|
||||
'all_tcp': {
|
||||
'name': 'ALL TCP',
|
||||
'ip_protocol': 'tcp',
|
||||
'from_port': '1',
|
||||
'to_port': '65535',
|
||||
},
|
||||
'http': {
|
||||
'name': 'HTTP',
|
||||
'ip_protocol': 'tcp',
|
||||
'from_port': '80',
|
||||
'to_port': '80',
|
||||
},
|
||||
}
|
||||
|
||||
NOSE_ARGS = ['--nocapture',
|
||||
'--nologcapture',
|
||||
'--with-coverage',
|
||||
'--cover-package=cuedashboard',
|
||||
'--cover-inclusive',
|
||||
'--all-modules']
|
||||
|
||||
CUE_ENDPOINT_URL = "http://127.0.0.1:8888"
|
|
@ -0,0 +1,9 @@
|
|||
import testtools
|
||||
|
||||
import cuedashboard.queues.tables as tables
|
||||
|
||||
|
||||
class FakeTest(testtools.TestCase):
|
||||
def test_foo(self):
|
||||
createCluster = tables.CreateCluster()
|
||||
self.assertTrue(createCluster.name, "create")
|
|
@ -1,5 +1,5 @@
|
|||
[metadata]
|
||||
name = cue-dashboard
|
||||
name = cuedashboard
|
||||
version = 1
|
||||
summary = Cue Dashboard
|
||||
description-file = README.rst
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
pep8==1.5.7
|
||||
flake8==2.2.3
|
||||
hacking>=0.9.2,<0.10
|
||||
coverage>=3.6
|
||||
discover
|
||||
mock>=1.0
|
||||
testrepository>=0.0.18
|
||||
testtools>=0.9.34
|
||||
unittest2
|
||||
django_nose
|
||||
|
||||
sphinx>=1.1.2,!=1.2.0,<1.3
|
||||
oslosphinx>=2.2.0 # Apache-2.0
|
||||
oslosphinx>=2.2.0 # Apache-2.0
|
||||
|
||||
http://tarballs.openstack.org/horizon/horizon-master.tar.gz#egg=horizon
|
||||
|
|
15
tox.ini
15
tox.ini
|
@ -1,13 +1,21 @@
|
|||
[tox]
|
||||
envlist = pep8
|
||||
envlist = py27,pep8
|
||||
minversion = 1.6
|
||||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
usedevelop = True
|
||||
install_command = pip install -U {opts} {packages}
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
NOSE_WITH_OPENSTACK=1
|
||||
NOSE_OPENSTACK_COLOR=1
|
||||
NOSE_OPENSTACK_RED=0.05
|
||||
NOSE_OPENSTACK_YELLOW=0.025
|
||||
NOSE_OPENSTACK_SHOW_ELAPSED=1
|
||||
DJANGO_SETTINGS_MODULE=cuedashboard.tests.settings
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands = python setup.py testr --slowest --testr-args='{posargs}'
|
||||
|
||||
[testenv:pep8]
|
||||
commands = flake8 {posargs}
|
||||
|
@ -15,6 +23,9 @@ commands = flake8 {posargs}
|
|||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
[testenv:cover]
|
||||
commands = python setup.py testr --coverage --testr-args='{posargs}'
|
||||
|
||||
[testenv:docs]
|
||||
commands = python setup.py build_sphinx
|
||||
|
||||
|
@ -22,4 +33,4 @@ commands = python setup.py build_sphinx
|
|||
show-source = true
|
||||
ignore = H101,H302,H803
|
||||
builtins = _
|
||||
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools,local_settings.py
|
||||
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools,local_settings.py
|
||||
|
|
Loading…
Reference in New Issue