Use our real-world context
This commit is contained in:
parent
5654aaa2f7
commit
4f06a4330a
|
@ -220,16 +220,11 @@ def get_default_context():
|
||||||
return [
|
return [
|
||||||
"https://www.w3.org/ns/activitystreams",
|
"https://www.w3.org/ns/activitystreams",
|
||||||
"https://w3id.org/security/v1",
|
"https://w3id.org/security/v1",
|
||||||
{"manuallyApprovesFollowers": "as:manuallyApprovesFollowers"},
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
def get_default_context_fw():
|
|
||||||
return [
|
|
||||||
"https://www.w3.org/ns/activitystreams",
|
|
||||||
"https://w3id.org/security/v1",
|
|
||||||
{"manuallyApprovesFollowers": "as:manuallyApprovesFollowers"},
|
|
||||||
"https://funkwhale.audio/ns",
|
"https://funkwhale.audio/ns",
|
||||||
|
{
|
||||||
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
||||||
|
"Hashtag": "as:Hashtag",
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ def test_actor_serializer_from_ap(db):
|
||||||
private, public = keys.get_key_pair()
|
private, public = keys.get_key_pair()
|
||||||
actor_url = "https://test.federation/actor"
|
actor_url = "https://test.federation/actor"
|
||||||
payload = {
|
payload = {
|
||||||
"@context": jsonld.get_default_context_fw(),
|
"@context": jsonld.get_default_context(),
|
||||||
"id": actor_url,
|
"id": actor_url,
|
||||||
"type": "Person",
|
"type": "Person",
|
||||||
"outbox": "https://test.com/outbox",
|
"outbox": "https://test.com/outbox",
|
||||||
|
@ -76,7 +76,7 @@ def test_actor_serializer_from_ap_no_icon_mediaType(db):
|
||||||
private, public = keys.get_key_pair()
|
private, public = keys.get_key_pair()
|
||||||
actor_url = "https://test.federation/actor"
|
actor_url = "https://test.federation/actor"
|
||||||
payload = {
|
payload = {
|
||||||
"@context": jsonld.get_default_context_fw(),
|
"@context": jsonld.get_default_context(),
|
||||||
"id": actor_url,
|
"id": actor_url,
|
||||||
"type": "Person",
|
"type": "Person",
|
||||||
"inbox": "https://test.com/inbox",
|
"inbox": "https://test.com/inbox",
|
||||||
|
@ -281,7 +281,7 @@ def test_accept_follow_serializer_save(factories):
|
||||||
follow = factories["federation.Follow"](approved=None)
|
follow = factories["federation.Follow"](approved=None)
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
"@context": jsonld.get_default_context_fw(),
|
"@context": jsonld.get_default_context(),
|
||||||
"id": follow.get_federation_id() + "/accept",
|
"id": follow.get_federation_id() + "/accept",
|
||||||
"type": "Accept",
|
"type": "Accept",
|
||||||
"actor": follow.target.fid,
|
"actor": follow.target.fid,
|
||||||
|
@ -301,7 +301,7 @@ def test_accept_follow_serializer_validates_on_context(factories):
|
||||||
follow = factories["federation.Follow"](approved=None)
|
follow = factories["federation.Follow"](approved=None)
|
||||||
impostor = factories["federation.Actor"]()
|
impostor = factories["federation.Actor"]()
|
||||||
data = {
|
data = {
|
||||||
"@context": jsonld.get_default_context_fw(),
|
"@context": jsonld.get_default_context(),
|
||||||
"id": follow.get_federation_id() + "/accept",
|
"id": follow.get_federation_id() + "/accept",
|
||||||
"type": "Accept",
|
"type": "Accept",
|
||||||
"actor": impostor.url,
|
"actor": impostor.url,
|
||||||
|
@ -337,7 +337,7 @@ def test_undo_follow_serializer_save(factories):
|
||||||
follow = factories["federation.Follow"](approved=True)
|
follow = factories["federation.Follow"](approved=True)
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
"@context": jsonld.get_default_context_fw(),
|
"@context": jsonld.get_default_context(),
|
||||||
"id": follow.get_federation_id() + "/undo",
|
"id": follow.get_federation_id() + "/undo",
|
||||||
"type": "Undo",
|
"type": "Undo",
|
||||||
"actor": follow.actor.fid,
|
"actor": follow.actor.fid,
|
||||||
|
@ -356,7 +356,7 @@ def test_undo_follow_serializer_validates_on_context(factories):
|
||||||
follow = factories["federation.Follow"](approved=True)
|
follow = factories["federation.Follow"](approved=True)
|
||||||
impostor = factories["federation.Actor"]()
|
impostor = factories["federation.Actor"]()
|
||||||
data = {
|
data = {
|
||||||
"@context": jsonld.get_default_context_fw(),
|
"@context": jsonld.get_default_context(),
|
||||||
"id": follow.get_federation_id() + "/undo",
|
"id": follow.get_federation_id() + "/undo",
|
||||||
"type": "Undo",
|
"type": "Undo",
|
||||||
"actor": impostor.url,
|
"actor": impostor.url,
|
||||||
|
@ -402,7 +402,7 @@ def test_paginated_collection_serializer(factories):
|
||||||
|
|
||||||
def test_paginated_collection_serializer_validation():
|
def test_paginated_collection_serializer_validation():
|
||||||
data = {
|
data = {
|
||||||
"@context": jsonld.get_default_context_fw(),
|
"@context": jsonld.get_default_context(),
|
||||||
"type": "Collection",
|
"type": "Collection",
|
||||||
"id": "https://test.federation/test",
|
"id": "https://test.federation/test",
|
||||||
"totalItems": 5,
|
"totalItems": 5,
|
||||||
|
@ -579,7 +579,7 @@ def test_music_library_serializer_from_private(factories, mocker):
|
||||||
"funkwhale_api.federation.utils.retrieve_ap_object", return_value=actor
|
"funkwhale_api.federation.utils.retrieve_ap_object", return_value=actor
|
||||||
)
|
)
|
||||||
data = {
|
data = {
|
||||||
"@context": jsonld.get_default_context_fw(),
|
"@context": jsonld.get_default_context(),
|
||||||
"audience": "",
|
"audience": "",
|
||||||
"name": "Hello",
|
"name": "Hello",
|
||||||
"summary": "World",
|
"summary": "World",
|
||||||
|
|
|
@ -389,7 +389,7 @@ def test_fetch_success(factories, r_mock, mocker):
|
||||||
tasks.fetch(fetch_id=fetch.pk)
|
tasks.fetch(fetch_id=fetch.pk)
|
||||||
|
|
||||||
fetch.refresh_from_db()
|
fetch.refresh_from_db()
|
||||||
payload["@context"].append("https://funkwhale.audio/ns")
|
|
||||||
assert fetch.status == "finished"
|
assert fetch.status == "finished"
|
||||||
assert init.call_count == 1
|
assert init.call_count == 1
|
||||||
assert init.call_args[0][1] == artist
|
assert init.call_args[0][1] == artist
|
||||||
|
@ -421,7 +421,7 @@ def test_fetch_webfinger(factories, r_mock, mocker):
|
||||||
tasks.fetch(fetch_id=fetch.pk)
|
tasks.fetch(fetch_id=fetch.pk)
|
||||||
|
|
||||||
fetch.refresh_from_db()
|
fetch.refresh_from_db()
|
||||||
payload["@context"].append("https://funkwhale.audio/ns")
|
|
||||||
assert fetch.status == "finished"
|
assert fetch.status == "finished"
|
||||||
assert fetch.object == actor
|
assert fetch.object == actor
|
||||||
assert init.call_count == 1
|
assert init.call_count == 1
|
||||||
|
@ -451,7 +451,7 @@ def test_fetch_rel_alternate(factories, r_mock, mocker):
|
||||||
tasks.fetch(fetch_id=fetch.pk)
|
tasks.fetch(fetch_id=fetch.pk)
|
||||||
|
|
||||||
fetch.refresh_from_db()
|
fetch.refresh_from_db()
|
||||||
ap_payload["@context"].append("https://funkwhale.audio/ns")
|
|
||||||
assert fetch.status == "finished"
|
assert fetch.status == "finished"
|
||||||
assert fetch.object == actor
|
assert fetch.object == actor
|
||||||
assert init.call_count == 1
|
assert init.call_count == 1
|
||||||
|
@ -482,7 +482,7 @@ def test_fetch_url(factory_name, serializer_class, factories, r_mock, mocker):
|
||||||
tasks.fetch(fetch_id=fetch.pk)
|
tasks.fetch(fetch_id=fetch.pk)
|
||||||
|
|
||||||
fetch.refresh_from_db()
|
fetch.refresh_from_db()
|
||||||
payload["@context"].append("https://funkwhale.audio/ns")
|
|
||||||
assert fetch.status == "finished"
|
assert fetch.status == "finished"
|
||||||
assert fetch.object == obj
|
assert fetch.object == obj
|
||||||
assert init.call_count == 1
|
assert init.call_count == 1
|
||||||
|
|
Loading…
Reference in New Issue