# Path: tenable_io/api/models.py
# class Group(BaseModel):
# 
#     def __init__(
#             self,
#             id=None,
#             name=None,
#             permissions=None,
#             user_count=None,
#     ):
#         self.id = id
#         self.name = name
#         self.permissions = permissions
#         self.user_count = user_count
# 
# class GroupList(BaseModel):
# 
#     def __init__(
#             self,
#             groups=None,
#     ):
#         self._groups = None
# 
#         self.groups = groups
# 
#     @property
#     def groups(self):
#         return self._groups
# 
#     @groups.setter
#     @BaseModel._model_list(Group)
#     def groups(self, groups):
#         self._groups = groups


import pytest
from tenable_io.api.models import Group, GroupList



@pytest.mark.vcr()
def test_groups_create(new_group):
    assert isinstance(new_group, Group), u'The `create` method did not return type `Group`.'


@pytest.mark.vcr()
def test_groups_list(client):
    group_list = client.groups_api.list()
    assert isinstance(group_list, GroupList), u'The `list` method did not return type `GroupList`.'


@pytest.mark.vcr()
def test_groups_edit(client, new_group):
    group = new_group
    assert client.groups_api.edit(group.id, 'test_group_edited'), u'The group name was not edited.'
    group_list = client.groups_api.list()

# Path: tenable_io/api/models.py
# class Group(BaseModel):
# 
#     def __init__(
#             self,
#             id=None,
#             name=None,
#             permissions=None,
#             user_count=None,
#     ):
#         self.id = id
#         self.name = name
#         self.permissions = permissions
#         self.user_count = user_count
# 
# class GroupList(BaseModel):
# 
#     def __init__(
#             self,
#             groups=None,
#     ):
#         self._groups = None
# 
#         self.groups = groups
# 
#     @property
#     def groups(self):
#         return self._groups
# 
#     @groups.setter
#     @BaseModel._model_list(Group)
#     def groups(self, groups):
#         self._groups = groups


# Path: tests/integration/api/test_groups.py
import pytest
from tenable_io.api.models import Group, GroupList




@pytest.mark.vcr()
def test_groups_create(new_group):
    assert isinstance(new_group, Group), u'The `create` method did not return type `Group`.'


@pytest.mark.vcr()
def test_groups_list(client):
    group_list = client.groups_api.list()
    assert isinstance(group_list, GroupList), u'The `list` method did not return type `GroupList`.'


@pytest.mark.vcr()
def test_groups_edit(client, new_group):
    group = new_group
    assert client.groups_api.edit(group.id, 'test_group_edited'), u'The group name was not edited.'
    group_list = client.groups_api.list()

    edited_group = [g for g in group_list.groups if g.id == group.id]