Sort out model identifiers in things_for_testing

thingy_objects
Marnanel Thurman 2018-09-27 17:53:25 +01:00
rodzic 132932d6c8
commit 7b5408ed4c
2 zmienionych plików z 13 dodań i 7 usunięć

Wyświetl plik

@ -169,7 +169,11 @@ class CollectionTests(TestCase):
path=path,
page_number=1,
expectedTotalItems=3,
expectedOnPage=['alice', 'bob', 'carol'],
expectedOnPage=[
'https://example.com/user/alice',
'https://example.com/user/bob',
'https://example.com/user/carol',
],
)
for name in ['alice', 'bob', 'carol']:
@ -185,7 +189,9 @@ class CollectionTests(TestCase):
path=path,
page_number=1,
expectedTotalItems=1,
expectedOnPage=['alice'],
)
expectedOnPage=[
'https://example.com/user/alice',
],
)

Wyświetl plik

@ -15,23 +15,23 @@ class ThingUserFollowingView(CollectionView):
def get_collection_items(self, *args, **kwargs):
return Activity.objects.filter(
f_type='Follow',
f_actor=ThingUser(name=kwargs['name']).url,
f_actor=ThingUser(name=kwargs['name']).activity_id,
accepted=True,
)
def _stringify_object(self, obj):
return ThingUser.objects.get(actor=obj.following).url
return obj.f_object
class ThingUserFollowersView(CollectionView):
def get_collection_items(self, *args, **kwargs):
return Activity.objects.filter(
f_type='Follow',
f_object=ThingUser(name=kwargs['name']).url,
f_object=ThingUser(name=kwargs['name']).activity_id,
accepted=True,
)
def _stringify_object(self, obj):
return ThingUser.objects.get(actor=obj.follower).url
return obj.f_actor