Skip to content
Snippets Groups Projects
Commit 78d8f1aa authored by Hakan Calim's avatar Hakan Calim
Browse files

NAT-286: fixed tox issues

parent 91ec53d4
No related branches found
No related tags found
1 merge request!89Feature/nat 286 create unit tests for netbox client
Pipeline #84269 passed
"""
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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment