Update Black & run for whole repository
This commit is contained in:
parent
68210d5330
commit
850dc69091
53 changed files with 441 additions and 149 deletions
|
|
@ -213,7 +213,8 @@ def test_mutation_set_attachment_cover(factory_name, factories, now, mocker):
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"factory_name", ["music.Track", "music.Album", "music.Artist"],
|
||||
"factory_name",
|
||||
["music.Track", "music.Album", "music.Artist"],
|
||||
)
|
||||
def test_album_mutation_description(factory_name, factories, mocker):
|
||||
mocker.patch("funkwhale_api.federation.routes.outbox.dispatch")
|
||||
|
|
@ -236,7 +237,8 @@ def test_album_mutation_description(factory_name, factories, mocker):
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"factory_name", ["music.Track", "music.Album", "music.Artist"],
|
||||
"factory_name",
|
||||
["music.Track", "music.Album", "music.Artist"],
|
||||
)
|
||||
def test_mutation_description_keep_tags(factory_name, factories, mocker):
|
||||
mocker.patch("funkwhale_api.federation.routes.outbox.dispatch")
|
||||
|
|
@ -256,14 +258,17 @@ def test_mutation_description_keep_tags(factory_name, factories, mocker):
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"factory_name", ["music.Track", "music.Album", "music.Artist"],
|
||||
"factory_name",
|
||||
["music.Track", "music.Album", "music.Artist"],
|
||||
)
|
||||
def test_mutation_tags_keep_descriptions(factory_name, factories, mocker):
|
||||
mocker.patch("funkwhale_api.federation.routes.outbox.dispatch")
|
||||
content = factories["common.Content"]()
|
||||
obj = factories[factory_name](description=content)
|
||||
mutation = factories["common.Mutation"](
|
||||
type="update", target=obj, payload={"tags": ["punk", "rock"]},
|
||||
type="update",
|
||||
target=obj,
|
||||
payload={"tags": ["punk", "rock"]},
|
||||
)
|
||||
mutation.apply()
|
||||
obj.refresh_from_db()
|
||||
|
|
|
|||
|
|
@ -427,7 +427,8 @@ def test_upload_with_channel(factories, uploaded_audio_file):
|
|||
"import_status": "draft",
|
||||
}
|
||||
serializer = serializers.UploadForOwnerSerializer(
|
||||
data=data, context={"user": user},
|
||||
data=data,
|
||||
context={"user": user},
|
||||
)
|
||||
assert serializer.is_valid(raise_exception=True) is True
|
||||
upload = serializer.save()
|
||||
|
|
@ -443,7 +444,8 @@ def test_upload_with_not_owned_channel_fails(factories, uploaded_audio_file):
|
|||
"audio_file": uploaded_audio_file,
|
||||
}
|
||||
serializer = serializers.UploadForOwnerSerializer(
|
||||
data=data, context={"user": user},
|
||||
data=data,
|
||||
context={"user": user},
|
||||
)
|
||||
assert serializer.is_valid() is False
|
||||
assert "channel" in serializer.errors
|
||||
|
|
@ -457,7 +459,8 @@ def test_upload_with_not_owned_library_fails(factories, uploaded_audio_file):
|
|||
"audio_file": uploaded_audio_file,
|
||||
}
|
||||
serializer = serializers.UploadForOwnerSerializer(
|
||||
data=data, context={"user": user},
|
||||
data=data,
|
||||
context={"user": user},
|
||||
)
|
||||
assert serializer.is_valid() is False
|
||||
assert "library" in serializer.errors
|
||||
|
|
@ -469,7 +472,8 @@ def test_upload_requires_library_or_channel(factories, uploaded_audio_file):
|
|||
"audio_file": uploaded_audio_file,
|
||||
}
|
||||
serializer = serializers.UploadForOwnerSerializer(
|
||||
data=data, context={"user": user},
|
||||
data=data,
|
||||
context={"user": user},
|
||||
)
|
||||
|
||||
with pytest.raises(
|
||||
|
|
@ -491,7 +495,8 @@ def test_upload_requires_library_or_channel_but_not_both(
|
|||
"channel": channel.uuid,
|
||||
}
|
||||
serializer = serializers.UploadForOwnerSerializer(
|
||||
data=data, context={"user": user},
|
||||
data=data,
|
||||
context={"user": user},
|
||||
)
|
||||
with pytest.raises(
|
||||
serializers.serializers.ValidationError,
|
||||
|
|
@ -547,7 +552,8 @@ def test_upload_with_channel_keeps_import_metadata(factories, uploaded_audio_fil
|
|||
"import_metadata": {"title": "hello"},
|
||||
}
|
||||
serializer = serializers.UploadForOwnerSerializer(
|
||||
data=data, context={"user": user},
|
||||
data=data,
|
||||
context={"user": user},
|
||||
)
|
||||
assert serializer.is_valid(raise_exception=True) is True
|
||||
upload = serializer.save()
|
||||
|
|
@ -564,7 +570,8 @@ def test_upload_with_channel_validates_import_metadata(factories, uploaded_audio
|
|||
"import_metadata": {"title": None},
|
||||
}
|
||||
serializer = serializers.UploadForOwnerSerializer(
|
||||
data=data, context={"user": user},
|
||||
data=data,
|
||||
context={"user": user},
|
||||
)
|
||||
with pytest.raises(serializers.serializers.ValidationError):
|
||||
assert serializer.is_valid(raise_exception=True)
|
||||
|
|
|
|||
|
|
@ -1082,7 +1082,9 @@ def test_process_channel_upload_forces_artist_and_attributed_to(
|
|||
upload.refresh_from_db()
|
||||
|
||||
expected_final_metadata = tasks.collections.ChainMap(
|
||||
{"upload_source": None}, expected_forced_values, {"funkwhale": {}},
|
||||
{"upload_source": None},
|
||||
expected_forced_values,
|
||||
{"funkwhale": {}},
|
||||
)
|
||||
assert upload.import_status == "finished"
|
||||
get_track_from_import_metadata.assert_called_once_with(
|
||||
|
|
@ -1175,7 +1177,8 @@ def test_tag_albums_from_tracks(queryset_equal_queries, factories, mocker):
|
|||
)
|
||||
|
||||
add_tags_batch.assert_called_once_with(
|
||||
get_tags_from_foreign_key.return_value, model=models.Album,
|
||||
get_tags_from_foreign_key.return_value,
|
||||
model=models.Album,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -1200,7 +1203,8 @@ def test_tag_artists_from_tracks(queryset_equal_queries, factories, mocker):
|
|||
)
|
||||
|
||||
add_tags_batch.assert_called_once_with(
|
||||
get_tags_from_foreign_key.return_value, model=models.Artist,
|
||||
get_tags_from_foreign_key.return_value,
|
||||
model=models.Artist,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue