# Path: sevenbridges/models/async_jobs.py
# class AsyncFileBulkRecord(FileBulkRecord):
# 
#     @classmethod
#     def parse_records(cls, result, api=None):
#         api = api or cls._API
# 
#         records = []
#         for item in result:
#             record = cls(api=api)
#             if 'error' in item:
#                 record.error = item['error']
#             if 'resource' in item:
#                 record.resource = item['resource']
#             records.append(record)
#         return records
# 
# Path: sevenbridges/models/enums.py
# class AsyncFileOperations:
#     COPY = 'copy'
#     DELETE = 'delete'
#     MOVE = 'move'
# 
# class AsyncJobStates:
#     RUNNING = 'RUNNING'
#     FINISHED = 'FINISHED'
#     SUBMITTED = 'SUBMITTED'
#     RESOLVING = 'RESOLVING'


import faker
import pytest
from sevenbridges.models.async_jobs import AsyncFileBulkRecord
from sevenbridges.models.enums import AsyncFileOperations, AsyncJobStates

def test_get_copy_files_job(api, given, verifier):
    # preconditions
    id = generator.uuid4()
    given.async_jobs.exists(id=id, type=AsyncFileOperations.COPY)

    # action
    job = api.async_jobs.get_file_copy_job(id=id)

    # verification
    assert job.id == id
    verifier.async_jobs.file_copy_job_fetched(id=id)


def test_get_move_files_job(api, given, verifier):
    # preconditions
    id = generator.uuid4()
    given.async_jobs.exists(id=id, type=AsyncFileOperations.MOVE)

    # action
    job = api.async_jobs.get_file_move_job(id=id)

    # verification
    assert job.id == id
    verifier.async_jobs.file_move_job_fetched(id=id)


def test_get_delete_files_job(api, given, verifier):
    # preconditions
    id = generator.uuid4()

# Path: sevenbridges/models/async_jobs.py
# class AsyncFileBulkRecord(FileBulkRecord):
# 
#     @classmethod
#     def parse_records(cls, result, api=None):
#         api = api or cls._API
# 
#         records = []
#         for item in result:
#             record = cls(api=api)
#             if 'error' in item:
#                 record.error = item['error']
#             if 'resource' in item:
#                 record.resource = item['resource']
#             records.append(record)
#         return records
# 
# Path: sevenbridges/models/enums.py
# class AsyncFileOperations:
#     COPY = 'copy'
#     DELETE = 'delete'
#     MOVE = 'move'
# 
# class AsyncJobStates:
#     RUNNING = 'RUNNING'
#     FINISHED = 'FINISHED'
#     SUBMITTED = 'SUBMITTED'
#     RESOLVING = 'RESOLVING'


# Path: tests/test_async_jobs.py
import faker
import pytest
from sevenbridges.models.async_jobs import AsyncFileBulkRecord
from sevenbridges.models.enums import AsyncFileOperations, AsyncJobStates


def test_get_copy_files_job(api, given, verifier):
    # preconditions
    id = generator.uuid4()
    given.async_jobs.exists(id=id, type=AsyncFileOperations.COPY)

    # action
    job = api.async_jobs.get_file_copy_job(id=id)

    # verification
    assert job.id == id
    verifier.async_jobs.file_copy_job_fetched(id=id)


def test_get_move_files_job(api, given, verifier):
    # preconditions
    id = generator.uuid4()
    given.async_jobs.exists(id=id, type=AsyncFileOperations.MOVE)

    # action
    job = api.async_jobs.get_file_move_job(id=id)

    # verification
    assert job.id == id
    verifier.async_jobs.file_move_job_fetched(id=id)


def test_get_delete_files_job(api, given, verifier):
    # preconditions
    id = generator.uuid4()

    given.async_jobs.exists(id=id, type=AsyncFileOperations.DELETE)