Skip to content

Commit

Permalink
No need to (badly) mock transfer task + small refactor
Browse files Browse the repository at this point in the history
Signed-off-by: onekiloparsec <[email protected]>
  • Loading branch information
onekiloparsec committed Jul 20, 2017
1 parent d08dec7 commit d30cd70
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions tests/tasks.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
from queued_storage.tasks import Transfer
from queued_storage.utils import import_attribute

from .models import TestModel


def test_task(name, cache_key,
local_path, remote_path,
local_options, remote_options):
local = import_attribute(local_path)(**local_options)
remote = import_attribute(remote_path)(**remote_options)
remote.save(name, local.open(name))


def delay(*args, **kwargs):
test_task(*args, **kwargs)

test_task.delay = delay


class NoneReturningTask(Transfer):
class NoneReturningTransferTask(Transfer):
def transfer(self, *args, **kwargs):
return None


class RetryingTask(Transfer):
class RetryingTransferTask(Transfer):
def transfer(self, *args, **kwargs):
if TestModel.retried:
return True
Expand Down

0 comments on commit d30cd70

Please sign in to comment.