genrss/tests/conftest.py

57 lines
1.6 KiB
Python
Raw Normal View History

2019-07-26 19:14:19 +03:00
import pytest
2019-08-21 21:34:46 +03:00
IMAGE_URL = 'https://s3.smartfridge.me/image.jpg'
SITE_URL = 'https://smartfridge.me/'
SITE_TITLE = 'Smart Fridge'
IMAGE_DESCRIPTION = 'a'*100
IMAGE_HEIGHT = 100
IMAGE_WIDTH = 100
2019-07-26 19:14:19 +03:00
@pytest.fixture(params=[
pytest.param((IMAGE_URL, None, None), id='+/-/-'),
pytest.param((IMAGE_URL, 1000, None), id='+/+/-'),
pytest.param((IMAGE_URL, 1000, 'image/png'), id='+/+/+'),
pytest.param((IMAGE_URL, None, 'image/png'), id='+/-/+'),
])
def enclosure_tuple(request):
return request.param
@pytest.fixture(params=[
pytest.param(dict(url=IMAGE_URL), id='+/-/-'),
pytest.param(dict(url=IMAGE_URL, size=1000), id='+/+/-'),
pytest.param(dict(url=IMAGE_URL, size=1000, type='image/png'), id='+/+/+'),
pytest.param(dict(url=IMAGE_URL, type='image/png'), id='+/-/+'),
])
def enclosure_dict(request):
return request.param
2019-08-21 21:34:46 +03:00
@pytest.fixture(params=[
pytest.param((None, None, None), id='-/-/-'),
pytest.param((IMAGE_DESCRIPTION, None, None), id='+/-/-'),
pytest.param((IMAGE_DESCRIPTION, 100, None), id='+/+/-'),
pytest.param((IMAGE_DESCRIPTION, 100, 200), id='+/+/+'),
])
def image_tuple(request):
return (IMAGE_URL, SITE_URL, SITE_TITLE) + request.param
@pytest.fixture(params=[
pytest.param(dict(), id='-/-/-'),
pytest.param(dict(description=IMAGE_DESCRIPTION), id='+/-/-'),
pytest.param(dict(description=IMAGE_DESCRIPTION, width=100), id='+/+/-'),
pytest.param(dict(description=IMAGE_DESCRIPTION, width=100, height=100),
id='+/+/+'),
])
def image_dict(request):
return dict(
url=IMAGE_URL,
link=SITE_URL,
title=SITE_TITLE,
**request.param
)