kopia lustrzana https://gitlab.com/marnanel/chapeau
test_tombstone passes
rodzic
d044415053
commit
7902a4d1f8
|
@ -122,7 +122,6 @@ class Tests(TestCase):
|
|||
)
|
||||
|
||||
|
||||
@skip("Tombstones are not supported in this version")
|
||||
class TestTombstone(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
@ -146,7 +145,8 @@ class TestTombstone(TestCase):
|
|||
_response_to_dict(response),
|
||||
)
|
||||
|
||||
queen_anne.entomb()
|
||||
queen_anne.gone = True
|
||||
queen_anne.save()
|
||||
|
||||
response = c.get('/users/queen_anne')
|
||||
|
||||
|
@ -156,7 +156,6 @@ class TestTombstone(TestCase):
|
|||
'id': 'https://testserver/users/queen_anne',
|
||||
'type': 'Tombstone',
|
||||
'former_type': 'Person',
|
||||
'name': 'queen_anne',
|
||||
},
|
||||
_response_to_dict(response),
|
||||
)
|
||||
|
|
|
@ -96,9 +96,6 @@ class KepiView(django.views.View):
|
|||
if '@context' not in data:
|
||||
data['@context'] = ATSIGN_CONTEXT
|
||||
|
||||
if 'former_type' in data:
|
||||
data['type'] = 'Tombstone'
|
||||
|
||||
result = JsonResponse(
|
||||
data=data,
|
||||
json_dumps_params={
|
||||
|
@ -197,10 +194,19 @@ class PersonView(KepiView):
|
|||
return result
|
||||
|
||||
def _render_object(self, something):
|
||||
serializer = bowler_serializers.PersonSerializer(
|
||||
something
|
||||
)
|
||||
return super()._render_object(serializer.data)
|
||||
if something.gone:
|
||||
result = {
|
||||
'type': 'Tombstone',
|
||||
'former_type': 'Person',
|
||||
'id': something.url,
|
||||
}
|
||||
else:
|
||||
serializer = bowler_serializers.PersonSerializer(
|
||||
something
|
||||
)
|
||||
result = serializer.data
|
||||
|
||||
return super()._render_object(result)
|
||||
|
||||
class FollowingView(KepiView):
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue