Add a gitreview and modify for unit-testing
Change-Id: Ib2eb728e092383a81fb2d888842fd2e1b1d7fbe7
This commit is contained in:
parent
94b9cf4820
commit
40cb671811
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.pyc
|
4
.gitreview
Normal file
4
.gitreview
Normal file
@ -0,0 +1,4 @@
|
||||
[gerrit]
|
||||
host=review.openstack.org
|
||||
port=29418
|
||||
project=openstack/meteos-ui.git
|
@ -14,8 +14,8 @@
|
||||
from horizon import exceptions
|
||||
from horizon.utils.memoized import memoized
|
||||
import logging
|
||||
from openstack_dashboard.api import base
|
||||
from meteosclient.api import client as meteos_client
|
||||
from openstack_dashboard.api import base
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -52,9 +52,9 @@ def meteosclient(request):
|
||||
LOG.debug('meteosclient connection created using the token "%s" and url'
|
||||
'"%s"' % (request.user.token.id, meteos_url))
|
||||
c = meteos_client.Client(username=request.user.username,
|
||||
project_id=request.user.tenant_id,
|
||||
input_auth_token=request.user.token.id,
|
||||
meteos_url=meteos_url)
|
||||
project_id=request.user.tenant_id,
|
||||
input_auth_token=request.user.token.id,
|
||||
meteos_url=meteos_url)
|
||||
return c
|
||||
|
||||
|
||||
@ -130,12 +130,12 @@ def dataset_delete(request, id):
|
||||
|
||||
|
||||
def dataset_list(request, search_opts=None, limit=None, marker=None,
|
||||
sort_key=None, sort_dir=None):
|
||||
sort_key=None, sort_dir=None):
|
||||
return meteosclient(request).datasets.list(search_opts,
|
||||
limit,
|
||||
marker,
|
||||
sort_key,
|
||||
sort_dir)
|
||||
limit,
|
||||
marker,
|
||||
sort_key,
|
||||
sort_dir)
|
||||
|
||||
|
||||
def dataset_show(request, id):
|
||||
@ -158,7 +158,7 @@ def model_delete(request, id):
|
||||
|
||||
|
||||
def model_list(request, search_opts=None, limit=None, marker=None,
|
||||
sort_key=None, sort_dir=None):
|
||||
sort_key=None, sort_dir=None):
|
||||
return meteosclient(request).models.list(search_opts,
|
||||
limit,
|
||||
marker,
|
||||
@ -186,7 +186,7 @@ def model_evaluation_delete(request, id):
|
||||
|
||||
|
||||
def model_evaluation_list(request, search_opts=None, limit=None, marker=None,
|
||||
sort_key=None, sort_dir=None):
|
||||
sort_key=None, sort_dir=None):
|
||||
return meteosclient(request).model_evaluations.list(search_opts,
|
||||
limit,
|
||||
marker,
|
||||
@ -214,12 +214,12 @@ def learning_delete(request, id):
|
||||
|
||||
|
||||
def learning_list(request, search_opts=None, limit=None, marker=None,
|
||||
sort_key=None, sort_dir=None):
|
||||
sort_key=None, sort_dir=None):
|
||||
return meteosclient(request).learnings.list(search_opts,
|
||||
limit,
|
||||
marker,
|
||||
sort_key,
|
||||
sort_dir)
|
||||
limit,
|
||||
marker,
|
||||
sort_key,
|
||||
sort_dir)
|
||||
|
||||
|
||||
def learning_show(request, id):
|
||||
|
@ -26,7 +26,7 @@ class Template(generic.View):
|
||||
@rest_utils.ajax()
|
||||
def get(self, request, id):
|
||||
"""Get a specific template"""
|
||||
return change_to_id(client.template_show(request, id).to_dict())
|
||||
return client.template_show(request, id).to_dict()
|
||||
|
||||
|
||||
@urls.register
|
||||
@ -79,7 +79,7 @@ class Experiment(generic.View):
|
||||
@rest_utils.ajax()
|
||||
def get(self, request, id):
|
||||
"""Get a specific experiment"""
|
||||
return change_to_id(client.experiment_show(request, id).to_dict())
|
||||
return client.experiment_show(request, id).to_dict()
|
||||
|
||||
|
||||
@urls.register
|
||||
@ -132,7 +132,7 @@ class Dataset(generic.View):
|
||||
@rest_utils.ajax()
|
||||
def get(self, request, id):
|
||||
"""Get a specific dataset"""
|
||||
return change_to_id(client.dataset_show(request, id).to_dict())
|
||||
return client.dataset_show(request, id).to_dict()
|
||||
|
||||
|
||||
@urls.register
|
||||
@ -185,7 +185,7 @@ class Model(generic.View):
|
||||
@rest_utils.ajax()
|
||||
def get(self, request, id):
|
||||
"""Get a specific model"""
|
||||
return change_to_id(client.model_show(request, id).to_dict())
|
||||
return client.model_show(request, id).to_dict()
|
||||
|
||||
|
||||
@urls.register
|
||||
@ -238,7 +238,7 @@ class ModelEvaluation(generic.View):
|
||||
@rest_utils.ajax()
|
||||
def get(self, request, id):
|
||||
"""Get a specific model_evaluation"""
|
||||
return change_to_id(client.model_evaluation_show(request, id).to_dict())
|
||||
return client.model_evaluation_show(request, id).to_dict()
|
||||
|
||||
|
||||
@urls.register
|
||||
@ -292,7 +292,7 @@ class Learning(generic.View):
|
||||
@rest_utils.ajax()
|
||||
def get(self, request, id):
|
||||
"""Get a specific learning"""
|
||||
return change_to_id(client.learning_show(request, id).to_dict())
|
||||
return client.learning_show(request, id).to_dict()
|
||||
|
||||
|
||||
@urls.register
|
||||
|
@ -18,4 +18,5 @@ PANEL_GROUP = 'machine_learning'
|
||||
PANEL_DASHBOARD = 'project'
|
||||
|
||||
# Python panel class of the PANEL to be added.
|
||||
ADD_PANEL = 'meteos_ui.content.machine_learning.model_evaluations.panel.ModelEvaluations'
|
||||
ADD_PANEL = 'meteos_ui.content.machine_learning.model_evaluations.panel.\
|
||||
ModelEvaluations'
|
||||
|
@ -22,6 +22,7 @@ HORIZON_CONFIG.pop('default_dashboard', None)
|
||||
# Update the dashboards with meteos_ui
|
||||
import openstack_dashboard.enabled
|
||||
from openstack_dashboard.utils import settings
|
||||
|
||||
import meteos_ui.enabled
|
||||
|
||||
settings.update_dashboards(
|
||||
|
8
tox.ini
8
tox.ini
@ -1,5 +1,5 @@
|
||||
[tox]
|
||||
envlist = py34,py27,py27dj18,pep8
|
||||
envlist = py35,py34,py27,py27dj18,pep8
|
||||
minversion = 2.0
|
||||
skipsdist = True
|
||||
|
||||
@ -18,6 +18,12 @@ deps = -r{toxinidir}/requirements.txt
|
||||
commands = python manage.py test {posargs} --settings=meteos_ui.test.settings
|
||||
|
||||
# Until python-meteosclient released, install from github temporary.
|
||||
[testenv:py35]
|
||||
basepython = python3.5
|
||||
commands =
|
||||
pip install git+https://github.com/openstack/python-meteosclient.git
|
||||
python manage.py test {posargs} --settings=meteos_ui.test.settings
|
||||
|
||||
[testenv:py27]
|
||||
basepython = python2.7
|
||||
commands =
|
||||
|
Loading…
Reference in New Issue
Block a user