Fixes errors caught in tests

This commit is contained in:
Mouse Reeve 2020-11-27 20:24:19 -08:00
parent 86cbb3edbd
commit 5638597112
3 changed files with 5 additions and 11 deletions

View file

@ -135,9 +135,9 @@ class ActivityObject:
# add images
for (model_key, value) in image_fields.items():
if not value:
continue
formatted_value = image_formatter(value)
if not formatted_value:
continue
getattr(instance, model_key).save(*formatted_value, save=True)
for (model_key, values) in many_to_many_fields.items():
@ -146,6 +146,8 @@ class ActivityObject:
# add one to many fields
for (model_key, values) in one_to_many_fields.items():
if values == MISSING:
continue
model_field = getattr(instance, model_key)
model = model_field.model
for item in values:

View file

@ -89,7 +89,7 @@ class Signature:
def verify(self, public_key, request):
''' verify rsa signature '''
if False:#http_date_age(request.headers['date']) > MAX_SIGNATURE_AGE:
if http_date_age(request.headers['date']) > MAX_SIGNATURE_AGE:
raise ValueError(
"Request too old: %s" % (request.headers['date'],))
public_key = RSA.import_key(public_key)

View file

@ -13,14 +13,6 @@
"sensitive": false,
"content": "commentary",
"type": "Quotation",
"attachment": [
{
"type": "Document",
"mediaType": "image//images/covers/2b4e4712-5a4d-4ac1-9df4-634cc9c7aff3jpg",
"url": "https://example.com/images/covers/2b4e4712-5a4d-4ac1-9df4-634cc9c7aff3jpg",
"name": "Cover of \"This Is How You Lose the Time War\""
}
],
"replies": {
"id": "https://example.com/user/mouse/quotation/13/replies",
"type": "Collection",