# Path: tenable_io/api/networks.py
# class NetworkRequest(BaseRequest):
# 
#     def __init__(
#             self,
#             name=None,
#             description=None,
#     ):
#         self.name = name
#         self.description = description
# 
#         assert self.name
# 
# class BulkAssignRequest(BaseRequest):
# 
#     def __init__(
#             self,
#             scanner_uuids=[],
#     ):
#         self.scanner_uuids = scanner_uuids
# 
# Path: tenable_io/api/models.py
# class Network(BaseModel):
# 
#     def __init__(
#             self,
#             owner_uuid=None,
#             created=None,
#             modified=None,
#             scanner_count=None,
#             uuid=None,
#             name=None,
#             description=None,
#             is_default=None,
#             created_by=None,
#             created_at=None,
#             modified_by=None,
#             created_in_seconds=None,
#             modified_in_seconds=None,
#     ):
#         self.owner_uuid = owner_uuid
#         self.created = created
#         self.modified = modified
#         self.scanner_count = scanner_count
#         self.uuid = uuid
#         self.name = name
#         self.description = description
#         self.is_default = is_default
#         self.created_by = created_by
#         self.created_at = created_at
#         self.modified_by = modified_by
#         self.created_in_seconds = created_in_seconds
#         self.modified_in_seconds = modified_in_seconds
# 
# class NetworkList(BaseModel):
# 
#     def __init__(
#             self,
#             networks=None,
#             pagination=None,
#     ):
#         self._networks = None
#         self.networks = networks
#         self._pagination = None
#         self.pagination = pagination
# 
#     @property
#     def networks(self):
#         return self._networks
# 
#     @networks.setter
#     @BaseModel._model_list(Network)
#     def networks(self, networks):
#         self._networks = networks
# 
#     @property
#     def pagination(self):
#         return self._pagination
# 
#     @pagination.setter
#     @BaseModel._model(FilterPagination)
#     def pagination(self, pagination):
#         self._pagination = pagination
# 
# class ScannerList(BaseModel):
# 
#     def __init__(
#             self,
#             scanners=None
#     ):
#         self._scanners = None
#         self.scanners = scanners
# 
#     @property
#     def scanners(self):
#         return self._scanners
# 
#     @scanners.setter
#     @BaseModel._model_list(Scanner)
#     def scanners(self, scanners):
#         self._scanners = scanners


import pytest
from tenable_io.api.networks import NetworkRequest, BulkAssignRequest
from tenable_io.api.models import Network, NetworkList, ScannerList


@pytest.mark.vcr()
def test_networks_list(client):
    networks = client.networks_api.list()
    assert isinstance(networks, NetworkList), u'The `list` method did not return type `NetworkList`.'


@pytest.mark.vcr()
def test_networks_details(client):
    network = client.networks_api.details('00000000-0000-0000-0000-000000000000') # default network uuid
    assert isinstance(network, Network), u'The `details` method did not return type `Network`.'


@pytest.mark.vcr()
def test_networks_create(client):
    network = client.networks_api.create(NetworkRequest(name="test_network", description="automated_test"))
    assert isinstance(network, Network), u'The `create` method did not return type `Network`.'


@pytest.mark.vcr()
def test_networks_update(client):
    network = client.networks_api.create(NetworkRequest(name="test_network2", description="automated_test"))
    network = client.networks_api.update(network.uuid, NetworkRequest(name="updated_network_name"))
    assert isinstance(network, Network), u'The `update` method did not return type `Network`.'
    assert network.name == 'updated_network_name', u'Expected the network name to be updated.'


@pytest.mark.vcr()
def test_networks_delete(client):

# Path: tenable_io/api/networks.py
# class NetworkRequest(BaseRequest):
# 
#     def __init__(
#             self,
#             name=None,
#             description=None,
#     ):
#         self.name = name
#         self.description = description
# 
#         assert self.name
# 
# class BulkAssignRequest(BaseRequest):
# 
#     def __init__(
#             self,
#             scanner_uuids=[],
#     ):
#         self.scanner_uuids = scanner_uuids
# 
# Path: tenable_io/api/models.py
# class Network(BaseModel):
# 
#     def __init__(
#             self,
#             owner_uuid=None,
#             created=None,
#             modified=None,
#             scanner_count=None,
#             uuid=None,
#             name=None,
#             description=None,
#             is_default=None,
#             created_by=None,
#             created_at=None,
#             modified_by=None,
#             created_in_seconds=None,
#             modified_in_seconds=None,
#     ):
#         self.owner_uuid = owner_uuid
#         self.created = created
#         self.modified = modified
#         self.scanner_count = scanner_count
#         self.uuid = uuid
#         self.name = name
#         self.description = description
#         self.is_default = is_default
#         self.created_by = created_by
#         self.created_at = created_at
#         self.modified_by = modified_by
#         self.created_in_seconds = created_in_seconds
#         self.modified_in_seconds = modified_in_seconds
# 
# class NetworkList(BaseModel):
# 
#     def __init__(
#             self,
#             networks=None,
#             pagination=None,
#     ):
#         self._networks = None
#         self.networks = networks
#         self._pagination = None
#         self.pagination = pagination
# 
#     @property
#     def networks(self):
#         return self._networks
# 
#     @networks.setter
#     @BaseModel._model_list(Network)
#     def networks(self, networks):
#         self._networks = networks
# 
#     @property
#     def pagination(self):
#         return self._pagination
# 
#     @pagination.setter
#     @BaseModel._model(FilterPagination)
#     def pagination(self, pagination):
#         self._pagination = pagination
# 
# class ScannerList(BaseModel):
# 
#     def __init__(
#             self,
#             scanners=None
#     ):
#         self._scanners = None
#         self.scanners = scanners
# 
#     @property
#     def scanners(self):
#         return self._scanners
# 
#     @scanners.setter
#     @BaseModel._model_list(Scanner)
#     def scanners(self, scanners):
#         self._scanners = scanners


# Path: tests/integration/api/test_networks.py
import pytest
from tenable_io.api.networks import NetworkRequest, BulkAssignRequest
from tenable_io.api.models import Network, NetworkList, ScannerList



@pytest.mark.vcr()
def test_networks_list(client):
    networks = client.networks_api.list()
    assert isinstance(networks, NetworkList), u'The `list` method did not return type `NetworkList`.'


@pytest.mark.vcr()
def test_networks_details(client):
    network = client.networks_api.details('00000000-0000-0000-0000-000000000000') # default network uuid
    assert isinstance(network, Network), u'The `details` method did not return type `Network`.'


@pytest.mark.vcr()
def test_networks_create(client):
    network = client.networks_api.create(NetworkRequest(name="test_network", description="automated_test"))
    assert isinstance(network, Network), u'The `create` method did not return type `Network`.'


@pytest.mark.vcr()
def test_networks_update(client):
    network = client.networks_api.create(NetworkRequest(name="test_network2", description="automated_test"))
    network = client.networks_api.update(network.uuid, NetworkRequest(name="updated_network_name"))
    assert isinstance(network, Network), u'The `update` method did not return type `Network`.'
    assert network.name == 'updated_network_name', u'Expected the network name to be updated.'


@pytest.mark.vcr()
def test_networks_delete(client):

    network = client.networks_api.create(NetworkRequest(name="test_network3", description="automated_test"))