create_person() also creates the Actor object

2019-08-17
Marnanel Thurman 2019-05-29 01:12:08 +01:00
rodzic cb9e99a208
commit 5ef582aaf6
1 zmienionych plików z 20 dodań i 2 usunięć

Wyświetl plik

@ -1,5 +1,6 @@
from django_kepi.models import create
from django_kepi.validation import IncomingMessage, validate
from django_kepi.models.actor import Actor
import httpretty
import logging
import httpsig
@ -56,7 +57,25 @@ def create_person(name,
spec.update(kwargs)
return create(spec)
actor_fields = {}
for extra in ['publicKey', 'privateKey']:
if extra in spec:
actor_fields[extra] = spec[extra]
del spec[extra]
result = create(spec)
if actor_fields:
# XXX kepi should allow us to create
# XXX this using create(), as part of
# XXX the Thing creation
actor = Actor(
thing=result,
**actor_fields,
)
actor.save()
return result
def mock_remote_object(
url,
@ -158,5 +177,4 @@ def remote_user(url, name,
'sharedInbox': sharedInbox,
}
return result