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
78d8f1aa
Commit
78d8f1aa
authored
1 year ago
by
Hakan Calim
Browse files
Options
Downloads
Patches
Plain Diff
NAT-286: fixed tox issues
parent
91ec53d4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!89
Feature/nat 286 create unit tests for netbox client
Pipeline
#84269
passed
1 year ago
Stage: tox
Stage: documentation
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/services/test_netbox.py
+10
-20
10 additions, 20 deletions
test/services/test_netbox.py
with
10 additions
and
20 deletions
test/services/test_netbox.py
+
10
−
20
View file @
78d8f1aa
"""
Unit tests for testing the netbox client
"""
"""
Unit tests for testing the netbox client.
"""
import
uuid
from
os
import
PathLike
...
...
@@ -136,7 +134,8 @@ def test_create_interface(mock_api, device, interface, data_config_filename: Pat
@patch
(
"
gso.services.netbox_client.pynetbox.api
"
)
def
test_reserve_interface_exception
(
mock_api
,
device
,
interface
,
data_config_filename
:
PathLike
):
"""
"""
Test for checking if interface is reserved.
If the interface is already reserved
the method should throw an exception
"""
...
...
@@ -158,9 +157,7 @@ def test_reserve_interface_exception(mock_api, device, interface, data_config_fi
@patch
(
"
gso.services.netbox_client.pynetbox.api
"
)
def
test_reserve_interface
(
mock_api
,
device
,
interface
,
data_config_filename
:
PathLike
):
"""
Test a normal reservation of a interface
"""
"""
Test a normal reservation of a interface.
"""
# Set interface to not reserved
interface
.
enabled
=
False
...
...
@@ -183,7 +180,8 @@ def test_reserve_interface(mock_api, device, interface, data_config_filename: Pa
@patch
(
"
gso.services.netbox_client.pynetbox.api
"
)
def
test_allocate_interface_exception
(
mock_api
,
device
,
interface
,
data_config_filename
:
PathLike
):
"""
"""
Test to check exception during allocation.
If the interface is already allocated
the method should throw an exception
"""
...
...
@@ -208,9 +206,7 @@ def test_allocate_interface_exception(mock_api, device, interface, data_config_f
@patch
(
"
gso.services.netbox_client.pynetbox.api
"
)
def
test_allocation_interface
(
mock_api
,
device
,
interface
,
data_config_filename
:
PathLike
):
"""
Test a normal allocation of a interface
"""
"""
Test a normal allocation of a interface.
"""
# Set interface to not allocated
interface
.
mark_connected
=
False
...
...
@@ -233,9 +229,7 @@ def test_allocation_interface(mock_api, device, interface, data_config_filename:
@patch
(
"
gso.services.netbox_client.pynetbox.api
"
)
def
test_delete_device
(
mock_api
,
device
,
data_config_filename
:
PathLike
):
"""
Test a delete of a device
"""
"""
Test a delete of a device.
"""
# Mock netbox api
mock_api
.
return_value
.
dcim
.
devices
.
get
.
return_value
=
device
...
...
@@ -251,9 +245,7 @@ def test_delete_device(mock_api, device, data_config_filename: PathLike):
@patch
(
"
gso.services.netbox_client.pynetbox.api
"
)
def
test_get_interfaces_by_device
(
mock_api
,
device
,
interface
,
data_config_filename
:
PathLike
):
"""
Test if a interface is returned for a device
"""
"""
Test if a interface is returned for a device.
"""
# Setup interface speed
speed
=
1000
...
...
@@ -270,9 +262,7 @@ def test_get_interfaces_by_device(mock_api, device, interface, data_config_filen
@patch
(
"
gso.services.netbox_client.pynetbox.api
"
)
def
test_attach_interface_to_lag
(
mock_api
,
device
,
interface
,
lag
,
data_config_filename
:
PathLike
):
"""
Test if a interface is attached correctly to a lag interface
"""
"""
Test if a interface is attached correctly to a lag interface.
"""
# Define site effect function
def
get_side_effect
(
**
kwargs
):
...
...
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