# Path: seedbox/db/models.py
# class Model(object):
# class Torrent(Model):
# class MediaFile(Model):
# class AppState(Model):
#     PK_NAME = 'id'
#     PK_NAME = 'torrent_id'
#     PK_NAME = 'media_id'
#     PK_NAME = 'name'
#     def __init__(self, **kwds):
#     def as_dict(self):
#     def items(self):
#     def __eq__(self, other):
#     def __iter__(self):
#     def __getitem__(self, name):
#     def __setitem__(self, name, value):
#     def __contains__(self, name):
#     def __str__(self):
#     def pk_filter(cls, value=None):
#     def make_empty(cls):
#     def __init__(self, torrent_id, name, created_at=None, updated_at=None,
#                  state=None, retry_count=None, failed=None, error_msg=None,
#                  invalid=None, purged=None, media_files=None):
#     def __init__(self, media_id, torrent_id, filename, file_ext,
#                  file_path=None, size=None, compressed=None, synced=None,
#                  missing=None, skipped=None, error_msg=None, total_time=None):
#     def __init__(self, name, value):
# 
# Path: seedbox/tasks/filecopy.py
# LOG = logging.getLogger(__name__)
# class CopyFile(base.BaseTask):
#     def is_actionable(media_file):
#     def execute(self):
# 
# Path: seedbox/tests/test.py
# class ConfiguredBaseTestCase(BaseTestCase):
#     def setUp(self):
#     def tearDown(self):
#     def _make_dir(self, dirname):
#     def set_required_options(self):


import os
from seedbox.db import models
from seedbox.tasks import filecopy
from seedbox.tests import test



class FileCopyTest(test.ConfiguredBaseTestCase):

    def setUp(self):
        super(FileCopyTest, self).setUp()

        if not os.path.exists(self.CONF.tasks.sync_path):
            os.mkdir(self.CONF.tasks.sync_path)

        self.media_file = models.MediaFile.make_empty()
        self.media_file.compressed = 0
        self.media_file.filename = 'fake_copy.mp4'
        self.media_file.file_path = '/tmp'

        open(os.path.join('/tmp', 'fake_copy.mp4'), 'w').close()

    def test_actionable(self):
        self.assertTrue(filecopy.CopyFile.is_actionable(self.media_file))

    def test_execute(self):

# Path: seedbox/db/models.py
# class Model(object):
# class Torrent(Model):
# class MediaFile(Model):
# class AppState(Model):
#     PK_NAME = 'id'
#     PK_NAME = 'torrent_id'
#     PK_NAME = 'media_id'
#     PK_NAME = 'name'
#     def __init__(self, **kwds):
#     def as_dict(self):
#     def items(self):
#     def __eq__(self, other):
#     def __iter__(self):
#     def __getitem__(self, name):
#     def __setitem__(self, name, value):
#     def __contains__(self, name):
#     def __str__(self):
#     def pk_filter(cls, value=None):
#     def make_empty(cls):
#     def __init__(self, torrent_id, name, created_at=None, updated_at=None,
#                  state=None, retry_count=None, failed=None, error_msg=None,
#                  invalid=None, purged=None, media_files=None):
#     def __init__(self, media_id, torrent_id, filename, file_ext,
#                  file_path=None, size=None, compressed=None, synced=None,
#                  missing=None, skipped=None, error_msg=None, total_time=None):
#     def __init__(self, name, value):
# 
# Path: seedbox/tasks/filecopy.py
# LOG = logging.getLogger(__name__)
# class CopyFile(base.BaseTask):
#     def is_actionable(media_file):
#     def execute(self):
# 
# Path: seedbox/tests/test.py
# class ConfiguredBaseTestCase(BaseTestCase):
#     def setUp(self):
#     def tearDown(self):
#     def _make_dir(self, dirname):
#     def set_required_options(self):


# Path: seedbox/tests/tasks/test_filecopy.py
import os
from seedbox.db import models
from seedbox.tasks import filecopy
from seedbox.tests import test




class FileCopyTest(test.ConfiguredBaseTestCase):

    def setUp(self):
        super(FileCopyTest, self).setUp()

        if not os.path.exists(self.CONF.tasks.sync_path):
            os.mkdir(self.CONF.tasks.sync_path)

        self.media_file = models.MediaFile.make_empty()
        self.media_file.compressed = 0
        self.media_file.filename = 'fake_copy.mp4'
        self.media_file.file_path = '/tmp'

        open(os.path.join('/tmp', 'fake_copy.mp4'), 'w').close()

    def test_actionable(self):
        self.assertTrue(filecopy.CopyFile.is_actionable(self.media_file))

    def test_execute(self):

        task = filecopy.CopyFile(self.media_file)