# 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)


import faker
import pytest
from sevenbridges.errors import SbgError


generator = faker.Factory.create()


def test_files_query(api, given, verifier):
    # preconditions
    total = 10
    owner = generator.user_name()
    project_short_name = generator.slug()
    id = f'{owner}/{project_short_name}'
    given.file.files_exist_for_project(id, 10)
    given.project.exists(id=id)

    # action
    project = api.projects.get(id)
    projects = api.files.query(project=project, limit=total)

    # verification
    assert projects.total == total
    assert len(projects) == total

    verifier.file.queried(project=project.id)


def test_files_query_with_token(api, given, verifier):
    # preconditions
    total = 20
    owner = generator.user_name()
    project_short_name = generator.slug()

# 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)


# Path: tests/test_files.py
import faker
import pytest
from sevenbridges.errors import SbgError



generator = faker.Factory.create()


def test_files_query(api, given, verifier):
    # preconditions
    total = 10
    owner = generator.user_name()
    project_short_name = generator.slug()
    id = f'{owner}/{project_short_name}'
    given.file.files_exist_for_project(id, 10)
    given.project.exists(id=id)

    # action
    project = api.projects.get(id)
    projects = api.files.query(project=project, limit=total)

    # verification
    assert projects.total == total
    assert len(projects) == total

    verifier.file.queried(project=project.id)


def test_files_query_with_token(api, given, verifier):
    # preconditions
    total = 20
    owner = generator.user_name()
    project_short_name = generator.slug()

    id = f'{owner}/{project_short_name}'