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
be0cb1e4
Commit
be0cb1e4
authored
1 year ago
by
Jorge Sasiain
Committed by
Neda Moeini
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
NAT-244: add unit test for clear_interface based on branch NAT-286
parent
41611f0f
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/services/test_netbox.py
+22
-1
22 additions, 1 deletion
test/services/test_netbox.py
with
22 additions
and
1 deletion
test/services/test_netbox.py
+
22
−
1
View file @
be0cb1e4
...
...
@@ -3,11 +3,11 @@
import
uuid
from
os
import
PathLike
from
unittest.mock
import
Mock
,
patch
import
pytest
from
pynetbox.core.response
import
Record
from
gso.products.product_blocks.site
import
SiteTier
from
gso.services.netbox_client
import
NetboxClient
from
gso.utils.exceptions
import
WorkflowStateError
...
...
@@ -289,3 +289,24 @@ def test_attach_interface_to_lag(mock_api, device, interface, lag, data_config_f
assert
lag_interface
.
lag
==
lag
.
id
assert
lag_interface
.
description
==
description
mock_save
.
assert_called_once
()
@patch
(
"
gso.services.netbox_client.pynetbox.api
"
)
def
test_free_interface
(
mock_api
,
device
,
interface
):
device_name
=
"
mx1.lab.geant.net
"
interface_name
=
"
et-0/0/1
"
# Define mock calls
mock_api
.
return_value
.
dcim
.
devices
.
get
.
return_value
=
device
mock_api
.
return_value
.
dcim
.
interfaces
.
get
.
return_value
=
interface
# Create a NetboxClient instance
netbox_client
=
NetboxClient
()
# Test clear_interface method on success
interface
.
mark_connected
=
True
interface
.
enabled
=
True
cleared_interface
=
netbox_client
.
free_interface
(
device_name
,
interface_name
)
assert
cleared_interface
.
enabled
is
False
assert
cleared_interface
.
mark_connected
is
False
assert
cleared_interface
.
description
==
""
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