2021-05-30 21:47:36 +02:00
|
|
|
import pytest
|
|
|
|
import responses
|
|
|
|
|
2021-08-16 10:49:52 +02:00
|
|
|
from mobilizon_reshare.config.config import get_settings
|
2021-05-30 21:47:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def mobilizon_url():
|
2021-07-12 22:17:49 +02:00
|
|
|
return get_settings()["source"]["mobilizon"]["url"]
|
2021-05-30 21:47:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
@responses.activate
|
|
|
|
@pytest.fixture
|
|
|
|
def mock_mobilizon_success_answer(mobilizon_answer, mobilizon_url):
|
|
|
|
with responses.RequestsMock() as rsps:
|
|
|
|
|
|
|
|
rsps.add(
|
2021-08-16 10:49:52 +02:00
|
|
|
responses.POST, mobilizon_url, json=mobilizon_answer, status=200,
|
2021-05-30 21:47:36 +02:00
|
|
|
)
|
|
|
|
yield
|
|
|
|
|
|
|
|
|
|
|
|
@responses.activate
|
|
|
|
@pytest.fixture
|
|
|
|
def mock_mobilizon_failure_answer(mobilizon_url):
|
|
|
|
with responses.RequestsMock() as rsps:
|
|
|
|
|
|
|
|
rsps.add(
|
2021-08-16 10:49:52 +02:00
|
|
|
responses.POST, mobilizon_url, status=500,
|
2021-05-30 21:47:36 +02:00
|
|
|
)
|
|
|
|
yield
|