Browse Source

Add a gitreview and modify for unit-testing

Change-Id: Ib2eb728e092383a81fb2d888842fd2e1b1d7fbe7
changes/28/427528/2
Hiroyuki Eguchi 2 years ago
parent
commit
40cb671811

+ 1
- 0
.gitignore View File

@@ -0,0 +1 @@
1
+*.pyc

+ 4
- 0
.gitreview View File

@@ -0,0 +1,4 @@
1
+[gerrit]
2
+host=review.openstack.org
3
+port=29418
4
+project=openstack/meteos-ui.git

+ 16
- 16
meteos_ui/api/client.py View File

@@ -14,8 +14,8 @@
14 14
 from horizon import exceptions
15 15
 from horizon.utils.memoized import memoized
16 16
 import logging
17
-from openstack_dashboard.api import base
18 17
 from meteosclient.api import client as meteos_client
18
+from openstack_dashboard.api import base
19 19
 
20 20
 
21 21
 LOG = logging.getLogger(__name__)
@@ -52,9 +52,9 @@ def meteosclient(request):
52 52
     LOG.debug('meteosclient connection created using the token "%s" and url'
53 53
               '"%s"' % (request.user.token.id, meteos_url))
54 54
     c = meteos_client.Client(username=request.user.username,
55
-                          project_id=request.user.tenant_id,
56
-                          input_auth_token=request.user.token.id,
57
-                          meteos_url=meteos_url)
55
+                             project_id=request.user.tenant_id,
56
+                             input_auth_token=request.user.token.id,
57
+                             meteos_url=meteos_url)
58 58
     return c
59 59
 
60 60
 
@@ -130,12 +130,12 @@ def dataset_delete(request, id):
130 130
 
131 131
 
132 132
 def dataset_list(request, search_opts=None, limit=None, marker=None,
133
-                    sort_key=None, sort_dir=None):
133
+                 sort_key=None, sort_dir=None):
134 134
     return meteosclient(request).datasets.list(search_opts,
135
-                                                  limit,
136
-                                                  marker,
137
-                                                  sort_key,
138
-                                                  sort_dir)
135
+                                               limit,
136
+                                               marker,
137
+                                               sort_key,
138
+                                               sort_dir)
139 139
 
140 140
 
141 141
 def dataset_show(request, id):
@@ -158,7 +158,7 @@ def model_delete(request, id):
158 158
 
159 159
 
160 160
 def model_list(request, search_opts=None, limit=None, marker=None,
161
-                    sort_key=None, sort_dir=None):
161
+               sort_key=None, sort_dir=None):
162 162
     return meteosclient(request).models.list(search_opts,
163 163
                                              limit,
164 164
                                              marker,
@@ -186,7 +186,7 @@ def model_evaluation_delete(request, id):
186 186
 
187 187
 
188 188
 def model_evaluation_list(request, search_opts=None, limit=None, marker=None,
189
-                    sort_key=None, sort_dir=None):
189
+                          sort_key=None, sort_dir=None):
190 190
     return meteosclient(request).model_evaluations.list(search_opts,
191 191
                                                         limit,
192 192
                                                         marker,
@@ -214,12 +214,12 @@ def learning_delete(request, id):
214 214
 
215 215
 
216 216
 def learning_list(request, search_opts=None, limit=None, marker=None,
217
-                    sort_key=None, sort_dir=None):
217
+                  sort_key=None, sort_dir=None):
218 218
     return meteosclient(request).learnings.list(search_opts,
219
-                                                  limit,
220
-                                                  marker,
221
-                                                  sort_key,
222
-                                                  sort_dir)
219
+                                                limit,
220
+                                                marker,
221
+                                                sort_key,
222
+                                                sort_dir)
223 223
 
224 224
 
225 225
 def learning_show(request, id):

+ 6
- 6
meteos_ui/api/rest_api.py View File

@@ -26,7 +26,7 @@ class Template(generic.View):
26 26
     @rest_utils.ajax()
27 27
     def get(self, request, id):
28 28
         """Get a specific template"""
29
-        return change_to_id(client.template_show(request, id).to_dict())
29
+        return client.template_show(request, id).to_dict()
30 30
 
31 31
 
32 32
 @urls.register
@@ -79,7 +79,7 @@ class Experiment(generic.View):
79 79
     @rest_utils.ajax()
80 80
     def get(self, request, id):
81 81
         """Get a specific experiment"""
82
-        return change_to_id(client.experiment_show(request, id).to_dict())
82
+        return client.experiment_show(request, id).to_dict()
83 83
 
84 84
 
85 85
 @urls.register
@@ -132,7 +132,7 @@ class Dataset(generic.View):
132 132
     @rest_utils.ajax()
133 133
     def get(self, request, id):
134 134
         """Get a specific dataset"""
135
-        return change_to_id(client.dataset_show(request, id).to_dict())
135
+        return client.dataset_show(request, id).to_dict()
136 136
 
137 137
 
138 138
 @urls.register
@@ -185,7 +185,7 @@ class Model(generic.View):
185 185
     @rest_utils.ajax()
186 186
     def get(self, request, id):
187 187
         """Get a specific model"""
188
-        return change_to_id(client.model_show(request, id).to_dict())
188
+        return client.model_show(request, id).to_dict()
189 189
 
190 190
 
191 191
 @urls.register
@@ -238,7 +238,7 @@ class ModelEvaluation(generic.View):
238 238
     @rest_utils.ajax()
239 239
     def get(self, request, id):
240 240
         """Get a specific model_evaluation"""
241
-        return change_to_id(client.model_evaluation_show(request, id).to_dict())
241
+        return client.model_evaluation_show(request, id).to_dict()
242 242
 
243 243
 
244 244
 @urls.register
@@ -292,7 +292,7 @@ class Learning(generic.View):
292 292
     @rest_utils.ajax()
293 293
     def get(self, request, id):
294 294
         """Get a specific learning"""
295
-        return change_to_id(client.learning_show(request, id).to_dict())
295
+        return client.learning_show(request, id).to_dict()
296 296
 
297 297
 
298 298
 @urls.register

+ 2
- 1
meteos_ui/enabled/_1760_machine_learning_model_evaluations_panel.py View File

@@ -18,4 +18,5 @@ PANEL_GROUP = 'machine_learning'
18 18
 PANEL_DASHBOARD = 'project'
19 19
 
20 20
 # Python panel class of the PANEL to be added.
21
-ADD_PANEL = 'meteos_ui.content.machine_learning.model_evaluations.panel.ModelEvaluations'
21
+ADD_PANEL = 'meteos_ui.content.machine_learning.model_evaluations.panel.\
22
+            ModelEvaluations'

+ 1
- 0
meteos_ui/test/settings.py View File

@@ -22,6 +22,7 @@ HORIZON_CONFIG.pop('default_dashboard', None)
22 22
 # Update the dashboards with meteos_ui
23 23
 import openstack_dashboard.enabled
24 24
 from openstack_dashboard.utils import settings
25
+
25 26
 import meteos_ui.enabled
26 27
 
27 28
 settings.update_dashboards(

+ 7
- 1
tox.ini View File

@@ -1,5 +1,5 @@
1 1
 [tox]
2
-envlist = py34,py27,py27dj18,pep8
2
+envlist = py35,py34,py27,py27dj18,pep8
3 3
 minversion = 2.0
4 4
 skipsdist = True
5 5
 
@@ -18,6 +18,12 @@ deps = -r{toxinidir}/requirements.txt
18 18
 commands = python manage.py test {posargs} --settings=meteos_ui.test.settings
19 19
 
20 20
 # Until python-meteosclient released, install from github temporary.
21
+[testenv:py35]
22
+basepython = python3.5
23
+commands =
24
+    pip install git+https://github.com/openstack/python-meteosclient.git
25
+    python manage.py test {posargs} --settings=meteos_ui.test.settings
26
+
21 27
 [testenv:py27]
22 28
 basepython = python2.7
23 29
 commands =

Loading…
Cancel
Save