Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inventory-provider
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
geant-swd
dashboardv3
inventory-provider
Commits
6d384217
Commit
6d384217
authored
6 years ago
by
Erik Reid
Browse files
Options
Downloads
Patches
Plain Diff
fix handling of snmp result list
parent
bb37ccc7
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_celery_worker.py
+8
-1
8 additions, 1 deletion
test/test_celery_worker.py
with
8 additions
and
1 deletion
test/test_celery_worker.py
+
8
−
1
View file @
6d384217
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
just checks that the worker methods call the right functions
just checks that the worker methods call the right functions
and some data ends up in the right place ... otherwise not very detailed
and some data ends up in the right place ... otherwise not very detailed
"""
"""
import
json
import
logging
import
logging
from
lxml
import
etree
from
lxml
import
etree
...
@@ -17,6 +18,12 @@ class MockedRedis(object):
...
@@ -17,6 +18,12 @@ class MockedRedis(object):
pass
pass
def
hset
(
self
,
name
,
key
,
value
):
def
hset
(
self
,
name
,
key
,
value
):
assert
isinstance
(
value
,
str
)
if
key
==
'
netconf
'
:
etree
.
fromstring
(
value
)
elif
key
==
'
snmp-interfaces
'
:
obj
=
json
.
loads
(
value
)
assert
isinstance
(
obj
,
dict
)
MockedRedis
.
db
.
setdefault
(
name
,
{})[
key
]
=
value
MockedRedis
.
db
.
setdefault
(
name
,
{})[
key
]
=
value
...
@@ -53,7 +60,7 @@ def test_snmp_refresh_interfaces(
...
@@ -53,7 +60,7 @@ def test_snmp_refresh_interfaces(
mocked_worker_module
,
mocker
,
cached_test_data
):
mocked_worker_module
,
mocker
,
cached_test_data
):
def
_mocked_snmp_interfaces
(
hostname
,
community
,
_
):
def
_mocked_snmp_interfaces
(
hostname
,
community
,
_
):
return
cached_test_data
[
hostname
][
"
snmp-interfaces
"
]
return
json
.
loads
(
cached_test_data
[
hostname
][
"
snmp-interfaces
"
]
)
mocker
.
patch
(
mocker
.
patch
(
'
inventory_provider.tasks.worker.snmp.get_router_interfaces
'
,
'
inventory_provider.tasks.worker.snmp.get_router_interfaces
'
,
...
...
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