# Path: sevenbridges/errors.py
# class SbgError(Exception):
#     """Base class for SBG errors.
# 
#     Provides a base exception for all errors
#     that are thrown by sevenbridges-python library.
#     """
# 
#     def __init__(self, message=None, code=None, status=None, more_info=None):
#         """
#         :param code: Custom error code
#         :param status: Http status code.
#         :param message: Message describing the error.
#         """
#         self.code = code
#         self.status = status
#         self.message = message
#         self.more_info = more_info
# 
#     def __str__(self):
#         return str(self.message)
# 
# class ResourceNotModified(SbgError):
#     def __init__(self):
#         super().__init__(
#             code=-1,
#             status=-1,
#             message=(
#                 'No relevant changes were detected in order to update the '
#                 'resource on the server.'
#             )
#         )


import faker
import pytest
from sevenbridges.errors import SbgError, ResourceNotModified


@pytest.mark.parametrize("name", [generator.name(), None])
def test_create_project(api, given, verifier, name):
    # preconditions
    project_description = generator.name()
    billing_group = generator.uuid4()
    settings = {
        "locked": False,
        "use_interruptible_instances": False,
        "use_memoization": True
    }

    given.project.can_be_created(
        name=name,
        billing_group=billing_group,
        description=project_description,
        settings=settings
    )

    # action
    if name:
        project = api.projects.create(
            name=name, billing_group=billing_group,
            description=project_description, tags=['test'],
            settings=settings
        )

        # verification
        assert project.name == name

# Path: sevenbridges/errors.py
# class SbgError(Exception):
#     """Base class for SBG errors.
# 
#     Provides a base exception for all errors
#     that are thrown by sevenbridges-python library.
#     """
# 
#     def __init__(self, message=None, code=None, status=None, more_info=None):
#         """
#         :param code: Custom error code
#         :param status: Http status code.
#         :param message: Message describing the error.
#         """
#         self.code = code
#         self.status = status
#         self.message = message
#         self.more_info = more_info
# 
#     def __str__(self):
#         return str(self.message)
# 
# class ResourceNotModified(SbgError):
#     def __init__(self):
#         super().__init__(
#             code=-1,
#             status=-1,
#             message=(
#                 'No relevant changes were detected in order to update the '
#                 'resource on the server.'
#             )
#         )


# Path: tests/test_projects.py
import faker
import pytest
from sevenbridges.errors import SbgError, ResourceNotModified



@pytest.mark.parametrize("name", [generator.name(), None])
def test_create_project(api, given, verifier, name):
    # preconditions
    project_description = generator.name()
    billing_group = generator.uuid4()
    settings = {
        "locked": False,
        "use_interruptible_instances": False,
        "use_memoization": True
    }

    given.project.can_be_created(
        name=name,
        billing_group=billing_group,
        description=project_description,
        settings=settings
    )

    # action
    if name:
        project = api.projects.create(
            name=name, billing_group=billing_group,
            description=project_description, tags=['test'],
            settings=settings
        )

        # verification
        assert project.name == name

        assert project.description == project_description