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):
|
class TestTombstone(TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -146,7 +145,8 @@ class TestTombstone(TestCase):
|
||||||
_response_to_dict(response),
|
_response_to_dict(response),
|
||||||
)
|
)
|
||||||
|
|
||||||
queen_anne.entomb()
|
queen_anne.gone = True
|
||||||
|
queen_anne.save()
|
||||||
|
|
||||||
response = c.get('/users/queen_anne')
|
response = c.get('/users/queen_anne')
|
||||||
|
|
||||||
|
@ -156,7 +156,6 @@ class TestTombstone(TestCase):
|
||||||
'id': 'https://testserver/users/queen_anne',
|
'id': 'https://testserver/users/queen_anne',
|
||||||
'type': 'Tombstone',
|
'type': 'Tombstone',
|
||||||
'former_type': 'Person',
|
'former_type': 'Person',
|
||||||
'name': 'queen_anne',
|
|
||||||
},
|
},
|
||||||
_response_to_dict(response),
|
_response_to_dict(response),
|
||||||
)
|
)
|
||||||
|
|
|
@ -96,9 +96,6 @@ class KepiView(django.views.View):
|
||||||
if '@context' not in data:
|
if '@context' not in data:
|
||||||
data['@context'] = ATSIGN_CONTEXT
|
data['@context'] = ATSIGN_CONTEXT
|
||||||
|
|
||||||
if 'former_type' in data:
|
|
||||||
data['type'] = 'Tombstone'
|
|
||||||
|
|
||||||
result = JsonResponse(
|
result = JsonResponse(
|
||||||
data=data,
|
data=data,
|
||||||
json_dumps_params={
|
json_dumps_params={
|
||||||
|
@ -197,10 +194,19 @@ class PersonView(KepiView):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _render_object(self, something):
|
def _render_object(self, something):
|
||||||
serializer = bowler_serializers.PersonSerializer(
|
if something.gone:
|
||||||
something
|
result = {
|
||||||
)
|
'type': 'Tombstone',
|
||||||
return super()._render_object(serializer.data)
|
'former_type': 'Person',
|
||||||
|
'id': something.url,
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
serializer = bowler_serializers.PersonSerializer(
|
||||||
|
something
|
||||||
|
)
|
||||||
|
result = serializer.data
|
||||||
|
|
||||||
|
return super()._render_object(result)
|
||||||
|
|
||||||
class FollowingView(KepiView):
|
class FollowingView(KepiView):
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue