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
65ead28f
Commit
65ead28f
authored
1 year ago
by
Hakan Calim
Browse files
Options
Downloads
Patches
Plain Diff
NAT-286: added test for reservation of interface
parent
50eb4925
No related branches found
No related tags found
1 merge request
!89
Feature/nat 286 create unit tests for netbox client
Pipeline
#84237
failed
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
+21
-0
21 additions, 0 deletions
test/services/test_netbox.py
with
21 additions
and
0 deletions
test/services/test_netbox.py
+
21
−
0
View file @
65ead28f
...
...
@@ -149,3 +149,24 @@ def test_reserve_interface_exception(mock_api, device, interface, data_config_fi
with
pytest
.
raises
(
WorkflowStateError
)
as
test_exception
:
NetBoxClient
().
reserve_interface
(
device
.
name
,
interface
.
name
)
assert
str
(
test_exception
.
value
)
==
exception_message
@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
"""
# Set interface to not reserved
interface
.
enabled
=
False
interface
.
api
=
mock_api
# Mock netbox api
mock_api
.
return_value
.
dcim
.
devices
.
get
.
return_value
=
device
mock_api
.
return_value
.
dcim
.
interfaces
.
get
.
return_value
=
interface
mock_api
.
return_value
.
dcim
.
interfaces
.
save
.
return_value
=
interface
# Check reservation of interface
updated_interface
=
NetBoxClient
().
reserve_interface
(
device
.
name
,
interface
.
name
)
assert
updated_interface
is
not
None
assert
updated_interface
.
enabled
is
not
True
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