Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TFS
controller
Commits
1c1c42aa
Commit
1c1c42aa
authored
2 years ago
by
Carlos Natalino Da Silva
Browse files
Options
Downloads
Patches
Plain Diff
Fixing the mocks for the context component.
parent
f3f21e6b
No related branches found
No related tags found
1 merge request
!54
Release 2.0.0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/webui/service/main/routes.py
+2
-2
2 additions, 2 deletions
src/webui/service/main/routes.py
src/webui/tests/test_unitary.py
+6
-1
6 additions, 1 deletion
src/webui/tests/test_unitary.py
with
8 additions
and
3 deletions
src/webui/service/main/routes.py
+
2
−
2
View file @
1c1c42aa
...
...
@@ -14,7 +14,7 @@
import
json
,
logging
from
flask
import
jsonify
,
redirect
,
render_template
,
Blueprint
,
flash
,
session
,
url_for
,
request
from
common.proto.context_pb2
import
Context
,
Device
,
Empty
,
Link
,
Topology
from
common.proto.context_pb2
import
Context
,
Device
,
Empty
,
Link
,
Topology
,
ContextIdList
from
context.client.ContextClient
import
ContextClient
from
device.client.DeviceClient
import
DeviceClient
from
webui.service.main.forms
import
ContextForm
,
DescriptorForm
...
...
@@ -66,7 +66,7 @@ def process_descriptors(descriptors):
def
home
():
context_client
.
connect
()
device_client
.
connect
()
response
=
context_client
.
ListContextIds
(
Empty
())
response
:
ContextIdList
=
context_client
.
ListContextIds
(
Empty
())
context_form
:
ContextForm
=
ContextForm
()
context_form
.
context
.
choices
.
append
((
''
,
'
Select...
'
))
for
context
in
response
.
context_ids
:
...
...
This diff is collapsed.
Click to expand it.
src/webui/tests/test_unitary.py
+
6
−
1
View file @
1c1c42aa
...
...
@@ -19,7 +19,7 @@ from flask.testing import FlaskClient
from
flask.app
import
Flask
from
flask.helpers
import
url_for
from
common.DeviceTypes
import
DeviceTypeEnum
from
common.proto.context_pb2
import
Empty
,
DeviceId
,
DeviceList
,
TopologyIdList
from
common.proto.context_pb2
import
ContextIdList
,
Empty
,
DeviceId
,
DeviceList
,
TopologyIdList
# from device.client.DeviceClient import DeviceClient
from
webui.service
import
create_app
...
...
@@ -38,6 +38,11 @@ class TestWebUI(ClientTestCase):
self
.
mocker_delete_device
.
start
()
self
.
addCleanup
(
self
.
mocker_delete_device
.
stop
)
self
.
mocker_list_context_ids
=
mock
.
patch
(
'
webui.service.device.routes.context_client.ListContextIds
'
)
self
.
mocker_list_context_ids
.
return_value
=
ContextIdList
()
# returns an empty list
self
.
mocker_list_context_ids
.
start
()
self
.
addCleanup
(
self
.
mocker_list_context_ids
.
stop
)
self
.
mocker_list_devices
=
mock
.
patch
(
'
webui.service.device.routes.context_client.ListDevices
'
)
self
.
mocker_list_devices
.
return_value
=
DeviceList
()
# returns an empty list
self
.
mocker_list_devices
.
start
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment