kopia lustrzana https://gitlab.com/jaywink/federation
Add test for ActivityPub Accept entity
rodzic
0b34b509b0
commit
273818dc43
|
@ -4,6 +4,16 @@ from federation.entities.activitypub.entities import ActivitypubProfile
|
||||||
|
|
||||||
|
|
||||||
class TestEntitiesConvertToAS2:
|
class TestEntitiesConvertToAS2:
|
||||||
|
def test_accept_to_as2(self, activitypubaccept):
|
||||||
|
result = activitypubaccept.to_as2()
|
||||||
|
assert result == {
|
||||||
|
"@context": CONTEXTS_DEFAULT,
|
||||||
|
"id": "https://localhost/accept",
|
||||||
|
"type": "Accept",
|
||||||
|
"actor": "https://localhost/profile",
|
||||||
|
"object": "https://example.com/follow/1234",
|
||||||
|
}
|
||||||
|
|
||||||
def test_post_to_as2(self, activitypubpost):
|
def test_post_to_as2(self, activitypubpost):
|
||||||
# TODO expand
|
# TODO expand
|
||||||
result = activitypubpost.to_as2()
|
result = activitypubpost.to_as2()
|
||||||
|
|
|
@ -2,7 +2,7 @@ import uuid
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from federation.entities.activitypub.entities import ActivitypubPost
|
from federation.entities.activitypub.entities import ActivitypubPost, ActivitypubAccept
|
||||||
from federation.entities.base import Profile
|
from federation.entities.base import Profile
|
||||||
from federation.entities.diaspora.entities import (
|
from federation.entities.diaspora.entities import (
|
||||||
DiasporaPost, DiasporaComment, DiasporaLike, DiasporaProfile, DiasporaRetraction,
|
DiasporaPost, DiasporaComment, DiasporaLike, DiasporaProfile, DiasporaRetraction,
|
||||||
|
@ -12,6 +12,15 @@ from federation.tests.factories.entities import ShareFactory
|
||||||
from federation.tests.fixtures.payloads import DIASPORA_PUBLIC_PAYLOAD
|
from federation.tests.fixtures.payloads import DIASPORA_PUBLIC_PAYLOAD
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def activitypubaccept():
|
||||||
|
return ActivitypubAccept(
|
||||||
|
activity_id="https://localhost/accept",
|
||||||
|
actor_id="https://localhost/profile",
|
||||||
|
target_id="https://example.com/follow/1234",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def profile():
|
def profile():
|
||||||
return Profile(
|
return Profile(
|
||||||
|
|
Ładowanie…
Reference in New Issue