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
69d073db
Commit
69d073db
authored
4 years ago
by
Robert Latta
Browse files
Options
Downloads
Patches
Plain Diff
added test for port_id_services
parent
aeb9db17
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_ims_data.py
+79
-1
79 additions, 1 deletion
test/test_ims_data.py
with
79 additions
and
1 deletion
test/test_ims_data.py
+
79
−
1
View file @
69d073db
...
@@ -5,7 +5,85 @@ from inventory_provider.db.ims import InventoryStatus
...
@@ -5,7 +5,85 @@ from inventory_provider.db.ims import InventoryStatus
from
inventory_provider.db.ims_data
import
lookup_lg_routers
,
\
from
inventory_provider.db.ims_data
import
lookup_lg_routers
,
\
otrs_get_customer_company_rows
,
\
otrs_get_customer_company_rows
,
\
otrs_get_customer_users_rows
,
get_node_locations
,
IMS_OPSDB_STATUS_MAP
,
\
otrs_get_customer_users_rows
,
get_node_locations
,
IMS_OPSDB_STATUS_MAP
,
\
get_fibre_info
get_fibre_info
,
get_port_id_services
def
test_get_port_id_services
(
mocker
):
called
=
False
def
_se
(
a
,
b
,
c
,
step_count
):
nonlocal
called
if
called
:
return
{}
else
:
called
=
True
with
open
(
'
test/data/ims_port_id_services_data.json
'
)
as
data
:
return
json
.
load
(
data
)
mocker
.
patch
.
object
(
inventory_provider
.
db
.
ims
.
IMS
,
'
get_filtered_entities
'
,
side_effect
=
_se
)
ds
=
inventory_provider
.
db
.
ims
.
IMS
(
'
dummy_base
'
,
'
dummy_username
'
,
'
dummy_password
'
)
res
=
list
(
get_port_id_services
(
ds
))
# this is the number of different product types that are considered service
# and speed types that that cover circuit types that have relevant circuits
# and ethernet product type as other relevant circuits also need tracking
assert
ds
.
get_filtered_entities
.
call_count
==
20
predicted
=
[
{
'
id
'
:
663060
,
'
name
'
:
'
RENATER_AP2
'
,
'
status
'
:
'
operational
'
,
'
circuit_type
'
:
'
service
'
,
'
service_type
'
:
'
GEANT IP
'
,
'
project
'
:
'
RENATER
'
,
'
port_a_id
'
:
224507
,
},
{
'
id
'
:
663104
,
'
name
'
:
'
ULAKBIM_AP2_IAS
'
,
'
status
'
:
'
operational
'
,
'
circuit_type
'
:
'
service
'
,
'
service_type
'
:
'
GEANT PEERING
'
,
'
project
'
:
'
ULAKBIM
'
,
'
port_a_id
'
:
224464
,
},
{
'
id
'
:
679324
,
'
name
'
:
'
AMSTERDAM-LONDON-100GBE-001(ETH)
'
,
'
status
'
:
'
operational
'
,
'
circuit_type
'
:
'
circuit
'
,
'
service_type
'
:
'
ETHERNET
'
,
'
project
'
:
'
ETH
'
,
'
port_a_id
'
:
6423107
,
'
port_b_id
'
:
6419340
,
},
{
'
id
'
:
679324
,
'
name
'
:
'
AMSTERDAM-LONDON-100GBE-001(ETH)
'
,
'
status
'
:
'
operational
'
,
'
circuit_type
'
:
'
circuit
'
,
'
service_type
'
:
'
ETHERNET
'
,
'
project
'
:
'
ETH
'
,
'
port_a_id
'
:
6419340
,
'
port_b_id
'
:
6423107
,
},
{
'
id
'
:
679324
,
'
name
'
:
'
AMSTERDAM-LONDON-100GBE-001(ETH)
'
,
'
status
'
:
'
operational
'
,
'
circuit_type
'
:
'
circuit
'
,
'
service_type
'
:
'
ETHERNET
'
,
'
project
'
:
'
ETH
'
,
'
port_a_id
'
:
6423111
}
]
assert
res
==
predicted
def
test_get_fibre_info
(
mocker
):
def
test_get_fibre_info
(
mocker
):
...
...
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