kopia lustrzana https://gitlab.com/marnanel/chapeau
Activity.deserialize() correctly accesses its list of types.
First test for it (which found the above bug).thingy_objects
rodzic
8c3d13ed46
commit
140dfe795f
|
@ -510,7 +510,7 @@ class Activity(models.Model):
|
|||
}
|
||||
|
||||
try:
|
||||
need_actor, need_object, need_target = TYPES[value['type']]
|
||||
need_actor, need_object, need_target = cls.TYPES[value['type']]
|
||||
except KeyError:
|
||||
raise ValueError('{} is not an Activity type'.format(value['type']))
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
from django.test import TestCase
|
||||
from django_kepi.models import Activity
|
||||
|
||||
class TestActivity(TestCase):
|
||||
|
||||
def test_parameters(self):
|
||||
|
||||
with self.assertRaisesMessage(ValueError, "is not an Activity type"):
|
||||
Activity.deserialize({
|
||||
"id": "https://example.com/id/1",
|
||||
"type": "Wombat",
|
||||
})
|
Ładowanie…
Reference in New Issue