Merge branch 'faster-ci' into 'develop'

Faster tests

See merge request funkwhale/funkwhale!1063
This commit is contained in:
Eliot Berriot 2020-03-23 16:22:20 +01:00
commit 2440550591
22 changed files with 110 additions and 68 deletions

View file

@ -64,7 +64,9 @@ def test_attachment(factories, now):
@pytest.mark.parametrize("args, expected", [([], [0]), ([True], [0]), ([False], [1])])
def test_attachment_queryset_attached(args, expected, factories, queryset_equal_list):
attachments = [
factories["music.Album"](artist__attachment_cover=None).attachment_cover,
factories["music.Album"](
with_cover=True, artist__attachment_cover=None
).attachment_cover,
factories["common.Attachment"](),
]

View file

@ -74,7 +74,7 @@ def test_prune_unattached_attachments(factories, settings, now):
)
attachments = [
# attached, kept
factories["music.Album"]().attachment_cover,
factories["music.Album"](with_cover=True).attachment_cover,
# recent, kept
factories["common.Attachment"](),
# too old, pruned

View file

@ -141,7 +141,7 @@ def test_render_html(text, content_type, permissive, expected):
def test_attach_file_url(factories):
album = factories["music.Album"]()
album = factories["music.Album"](with_cover=True)
existing_attachment = album.attachment_cover
assert existing_attachment is not None
@ -160,7 +160,7 @@ def test_attach_file_url(factories):
def test_attach_file_url_fetch(factories, r_mock):
album = factories["music.Album"]()
album = factories["music.Album"](with_cover=True)
data = {"mimetype": "image/jpeg", "url": "https://example.com/test.jpg"}
r_mock.get(data["url"], body=io.BytesIO(b"content"))