Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async mock should return the mocked object not a proxy to it #78

Open
komuw opened this issue Jun 6, 2019 · 0 comments
Open

async mock should return the mocked object not a proxy to it #78

komuw opened this issue Jun 6, 2019 · 0 comments

Comments

@komuw
Copy link
Owner

komuw commented Jun 6, 2019

currently you need to do:

wiji/tests/test_worker.py

Lines 179 to 188 in 80a3aaf

) as mock_dequeue:
mock_dequeue.mock.return_value = json.dumps(item)
worker = wiji.Worker(the_task=self.myTask, worker_id="myWorkerID1")
# queue and consume task
self.myTask.synchronous_delay(a=21, b=535)
dequeued_item = self._run(worker.consume_tasks(TESTING=True))
self.assertEqual(dequeued_item["version"], 1)
self.assertTrue(mock_dequeue.mock.called)
self.assertEqual(mock_dequeue.mock.call_args[1], {"queue_name": self.myTask.queue_name})

mock_dequeue.mock.return_value = json.dumps(item)

self.assertTrue(mock_dequeue.mock.called)

Instead we should be able to write:

mock_dequeue.return_value = json.dumps(item)

self.assertTrue(mock_dequeue.called)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant