refactoring: move
This commit is contained in:
parent
6945760045
commit
456cb4157d
@ -25,6 +25,7 @@ logger = logging.getLogger()
|
||||
|
||||
|
||||
pytest_plugins = [
|
||||
"test.fixtures.consumer",
|
||||
"test.fixtures.input",
|
||||
"test.fixtures.pdf",
|
||||
"test.fixtures.server",
|
||||
|
||||
30
test/fixtures/consumer.py
vendored
Normal file
30
test/fixtures/consumer.py
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
from _operator import itemgetter
|
||||
|
||||
import pytest
|
||||
|
||||
from pyinfra.queue.consumer import Consumer
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def consumer(queue_manager, callback):
|
||||
return Consumer(callback, queue_manager)
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def access_callback():
|
||||
return itemgetter("fileId")
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def items():
|
||||
def inner():
|
||||
for i in range(3):
|
||||
body = {
|
||||
"dossierId": "folder",
|
||||
"fileId": f"file{i}",
|
||||
"targetFileExtension": "in.gz",
|
||||
"responseFileExtension": "out.gz",
|
||||
}
|
||||
yield f"{i}".encode(), body
|
||||
|
||||
return list(inner())
|
||||
0
test/integration_tests/__init__.py
Normal file
0
test/integration_tests/__init__.py
Normal file
@ -5,37 +5,11 @@ from operator import itemgetter
|
||||
import pytest
|
||||
|
||||
from pyinfra.exceptions import ProcessingFailure
|
||||
from pyinfra.queue.consumer import Consumer
|
||||
from pyinfra.visitor import get_object_descriptor, ForwardingStrategy
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def consumer(queue_manager, callback):
|
||||
return Consumer(callback, queue_manager)
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def access_callback():
|
||||
return itemgetter("fileId")
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def items():
|
||||
def inner():
|
||||
for i in range(3):
|
||||
body = {
|
||||
"dossierId": "folder",
|
||||
"fileId": f"file{i}",
|
||||
"targetFileExtension": "in.gz",
|
||||
"responseFileExtension": "out.gz",
|
||||
}
|
||||
yield f"{i}".encode(), body
|
||||
|
||||
return list(inner())
|
||||
|
||||
|
||||
class TestConsumer:
|
||||
@pytest.mark.parametrize("queue_manager_name", ["mock", "pika"], scope="session")
|
||||
def test_consuming_empty_input_queue_does_not_put_anything_on_output_queue(self, consumer, queue_manager):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user