def test_group():
        """Tests for method groups"""
        client = CBWApi(API_URL, API_KEY, SECRET_KEY)

        with vcr.use_cassette('spec/fixtures/vcr_cassettes/groups.yaml'):
            response = client.groups()
        for group in response:
            assert isinstance(group, CBWGroup) is True

        with vcr.use_cassette('spec/fixtures/vcr_cassettes/group.yaml'):
            response = client.group('12')

            assert isinstance(response, CBWGroup) is True

        params = {
            "name": "test",  #Required, name of the group
            "description":
            "test description",  #Description of the created group
        }
        with vcr.use_cassette('spec/fixtures/vcr_cassettes/create_group.yaml'):
            response = client.create_group(params)

            assert isinstance(response, CBWGroup) is True

        params["name"] = "test_change"
        with vcr.use_cassette('spec/fixtures/vcr_cassettes/update_group.yaml'):
            response = client.update_group('12', params)

            assert isinstance(response, CBWGroup) is True

        with vcr.use_cassette('spec/fixtures/vcr_cassettes/delete_group.yaml'):
            response = client.delete_group('12')

            assert isinstance(response, CBWGroup) is True
    def test_group():
        """Tests for method groups"""
        client = CBWApi(API_URL, API_KEY, SECRET_KEY)

        groups_validate = [
            "cbw_object(id=13, name='production', description='', color='#12afcb')",
            "cbw_object(id=14, name='Development', description='', color='#12afcb')"
        ]

        with vcr.use_cassette('spec/fixtures/vcr_cassettes/groups.yaml'):
            response = client.groups()

            assert str(response[2]) == groups_validate[0]
            assert str(response[3]) == groups_validate[1]

        with vcr.use_cassette('spec/fixtures/vcr_cassettes/group.yaml'):
            response = client.group('13')

            assert str(response) == groups_validate[0]

        params = {
            "name": "test",
            "description": "test description",
        }

        with vcr.use_cassette('spec/fixtures/vcr_cassettes/create_group.yaml'):
            response = client.create_group(params)

            assert response.name == "test", response.description == "test description"

        params["name"] = "test_change"

        with vcr.use_cassette('spec/fixtures/vcr_cassettes/update_group.yaml'):
            response = client.update_group('12', params)

            assert response.name == "test_change"

        with vcr.use_cassette('spec/fixtures/vcr_cassettes/delete_group.yaml'):
            response = client.delete_group('12')

            assert response.name == "test_change"
"""POST request to /api/v3/groups to create a new group"""

import os
from configparser import ConfigParser
from cbw_api_toolbox.cbw_api import CBWApi

CONF = ConfigParser()
CONF.read(
    os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', 'api.conf'))
CLIENT = CBWApi(CONF.get('cyberwatch', 'url'),
                CONF.get('cyberwatch', 'api_key'),
                CONF.get('cyberwatch', 'secret_key'))

PARAMS = {
    "name": "",  #Required, name of the group
    "description": "",  #Description of the created group
    "color": ""  #Colour of the group
}

CLIENT.create_group(PARAMS)