Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GÉANT Service Orchestrator
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
GÉANT Orchestration and Automation Team
GAP
GÉANT Service Orchestrator
Commits
0a708d56
Commit
0a708d56
authored
1 year ago
by
Jorge Sasiain
Committed by
Neda Moeini
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
NAT-244: update terminate_iptrunk workflow test with nextbox client
parent
be0cb1e4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!94
Feature/Netbox integration terminate ip trunk
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/workflows/iptrunk/test_terminate_iptrunk.py
+41
-0
41 additions, 0 deletions
test/workflows/iptrunk/test_terminate_iptrunk.py
with
41 additions
and
0 deletions
test/workflows/iptrunk/test_terminate_iptrunk.py
+
41
−
0
View file @
0a708d56
...
...
@@ -13,6 +13,46 @@ from test.workflows import (
)
class
MockedNetboxClient
:
class
BaseMockObject
:
def
__init__
(
self
,
**
kwargs
):
for
key
,
value
in
kwargs
.
items
():
setattr
(
self
,
key
,
value
)
def
get_device_by_name
(
self
):
return
self
.
BaseMockObject
(
id
=
1
,
name
=
"
test
"
)
def
get_interface_by_name_and_by_device_id
(
self
):
return
self
.
BaseMockObject
(
id
=
1
,
name
=
"
test
"
)
def
delete_interface
(
self
):
return
None
def
clear_interface
(
self
):
return
self
.
BaseMockObject
(
id
=
1
,
name
=
"
test
"
)
@pytest.fixture
def
netbox_client_mock
():
# Mock NetboxClient methods
with
(
patch
(
"
gso.services.netbox_client.NetboxClient.get_device_by_name
"
)
as
mock_get_device_by_name
,
patch
(
"
gso.services.netbox_client.NetboxClient.get_interface_by_name_and_by_device_id
"
)
as
mock_get_interface_by_name_and_by_device_id
,
patch
(
"
gso.services.netbox_client.NetboxClient.delete_interface
"
)
as
mock_delete_interface
,
patch
(
"
gso.services.netbox_client.NetboxClient.clear_interface
"
)
as
mock_clear_interface
,
):
mock_get_device_by_name
.
return_value
=
MockedNetboxClient
().
get_device_by_name
()
mock_get_interface_by_name_and_by_device_id
.
return_value
=
(
MockedNetboxClient
().
get_interface_by_name_and_by_device_id
()
)
mock_delete_interface
.
return_value
=
MockedNetboxClient
().
delete_interface
()
mock_clear_interface
.
return_value
=
MockedNetboxClient
().
clear_interface
()
yield
@pytest.mark.workflow
@patch
(
"
gso.workflows.iptrunk.terminate_iptrunk.provisioning_proxy.provision_ip_trunk
"
)
@patch
(
"
gso.workflows.iptrunk.terminate_iptrunk.provisioning_proxy.deprovision_ip_trunk
"
)
...
...
@@ -23,6 +63,7 @@ def test_iptrunk_modify_isis_metric_success(
mock_provision_ip_trunk
,
iptrunk_subscription_factory
,
faker
,
netbox_client_mock
,
):
# Set up mock return values
product_id
=
iptrunk_subscription_factory
()
...
...
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