Skip to content
Snippets Groups Projects
  • Sybren A. Stüvel's avatar
    9e55ccd6
    Moved from requirements.txt to Pipfile · 9e55ccd6
    Sybren A. Stüvel authored
    This also means that we need a `tests/__init__.py` file; this file makes
    py.test undertand what is our sources directory, and thus allows them to
    `import flamenco_worker`. As a result, the test imports from tests/*.py
    need to change to relative imports.
    9e55ccd6
    History
    Moved from requirements.txt to Pipfile
    Sybren A. Stüvel authored
    This also means that we need a `tests/__init__.py` file; this file makes
    py.test undertand what is our sources directory, and thus allows them to
    `import flamenco_worker`. As a result, the test imports from tests/*.py
    need to change to relative imports.
test_coro_mock.py 539 B
"""Unit test for our CoroMock implementation."""

import asyncio
import unittest


class CoroMockTest(unittest.TestCase):
    def setUp(self):
        from flamenco_worker.cli import construct_asyncio_loop
        self.loop = construct_asyncio_loop()

    def test_setting_return_value(self):
        from .mock_responses import CoroMock

        cm = CoroMock()
        cm.coro.return_value = '123'

        result = self.loop.run_until_complete(cm(3, 4))

        cm.assert_called_once_with(3, 4)
        self.assertEqual('123', result)