chapeau/tests/test_activity.py

31 wiersze
991 B
Python
Czysty Zwykły widok Historia

from django.test import TestCase
from django_kepi.models import Activity
FRED_URL = 'https://users.example.com/user/fred'
class TestActivity(TestCase):
def test_parameters(self):
with self.assertRaisesMessage(ValueError, "is not an Activity type"):
Activity.create({
2018-09-12 22:49:25 +00:00
"id": "https://example.com/id/1",
"type": "Wombat",
})
with self.assertRaisesMessage(ValueError, "Remote activities must have an id"):
Activity.create({
2018-09-12 22:49:25 +00:00
"type": "Create",
2019-03-03 21:30:18 +00:00
"actor": "https://example.com/user/fred",
"object": {
"type": "Note",
2019-03-03 21:30:18 +00:00
},
},
sender="https://remote.example.com")
2018-09-12 22:49:25 +00:00
with self.assertRaisesMessage(ValueError, "Wrong parameters for Activity type"):
Activity.create({
2018-09-12 22:49:25 +00:00
"id": "https://example.com/id/1",
"type": "Create",
})