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
1f1bf8b8
Commit
1f1bf8b8
authored
3 years ago
by
Erik Reid
Browse files
Options
Downloads
Patches
Plain Diff
added /poller/eumetsat-multicast test
parent
5243d531
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_general_poller_routes.py
+33
-2
33 additions, 2 deletions
test/test_general_poller_routes.py
with
33 additions
and
2 deletions
test/test_general_poller_routes.py
+
33
−
2
View file @
1f1bf8b8
import
json
import
jsonschema
from
inventory_provider.routes
.poller
import
INTERFACE_LIST_SCHEMA
from
inventory_provider.routes
import
poller
DEFAULT_REQUEST_HEADERS
=
{
"
Content-type
"
:
"
application/json
"
,
...
...
@@ -15,7 +15,38 @@ def test_get_all_interfaces(client):
assert
rv
.
status_code
==
200
assert
rv
.
is_json
response_data
=
json
.
loads
(
rv
.
data
.
decode
(
'
utf-8
'
))
jsonschema
.
validate
(
response_data
,
INTERFACE_LIST_SCHEMA
)
jsonschema
.
validate
(
response_data
,
poller
.
INTERFACE_LIST_SCHEMA
)
response_routers
=
{
ifc
[
'
router
'
]
for
ifc
in
response_data
}
assert
len
(
response_routers
)
>
1
,
\
'
there should data from be lots of routers
'
def
test_all_router_interface_speeds
(
client
):
rv
=
client
.
post
(
f
'
/poller/speeds
'
,
headers
=
DEFAULT_REQUEST_HEADERS
)
assert
rv
.
status_code
==
200
response
=
json
.
loads
(
rv
.
data
.
decode
(
"
utf-8
"
))
jsonschema
.
validate
(
response
,
poller
.
INTERFACE_SPEED_LIST_SCHEMA
)
assert
response
# at least shouldn't be empty
response_routers
=
{
ifc
[
'
router
'
]
for
ifc
in
response
}
assert
len
(
response_routers
)
>
1
,
\
'
there should data from be lots of routers
'
def
test_eumetsat_multicast
(
mocker
,
client
):
# routers don't have snmp acl's for us
mocker
.
patch
(
'
inventory_provider.juniper.snmp_community_string
'
)
\
.
return_value
=
'
blah
'
rv
=
client
.
get
(
'
/poller/eumetsat-multicast
'
,
headers
=
DEFAULT_REQUEST_HEADERS
)
assert
rv
.
status_code
==
200
assert
rv
.
is_json
response_data
=
json
.
loads
(
rv
.
data
.
decode
(
'
utf-8
'
))
jsonschema
.
validate
(
response_data
,
poller
.
MULTICAST_SUBSCRIPTION_LIST_SCHEMA
)
assert
response_data
,
"
the subscription list shouldn
'
t be empty
"
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