kopia lustrzana https://gitlab.com/marnanel/chapeau
test_activity brought up to date with changes in create() params
rodzic
1a9e124e57
commit
244da31b47
|
@ -14,52 +14,49 @@ class TestThing(TestCase):
|
|||
def test_bad_type(self):
|
||||
|
||||
with self.assertRaisesMessage(ValueError, "is not a thing type"):
|
||||
Thing.create({
|
||||
"id": REMOTE_ID_1,
|
||||
"type": "Wombat",
|
||||
})
|
||||
Thing.create(
|
||||
f_id = REMOTE_ID_1,
|
||||
f_type = "Wombat",
|
||||
)
|
||||
|
||||
def test_remote_no_id(self):
|
||||
|
||||
with self.assertRaisesMessage(ValueError, "Remote things must have an id"):
|
||||
Thing.create({
|
||||
"type": "Create",
|
||||
"actor": "https://example.com/user/fred",
|
||||
"object": {
|
||||
"type": "Note",
|
||||
},
|
||||
},
|
||||
Thing.create(
|
||||
f_type = "Create",
|
||||
f_actor = "https://example.com/user/fred",
|
||||
f_object = SAMPLE_NOTE,
|
||||
sender="https://remote.example.com")
|
||||
|
||||
def test_create_create_wrong_params(self):
|
||||
|
||||
with self.assertRaisesMessage(ValueError, "Wrong parameters for thing type"):
|
||||
Thing.create({
|
||||
"id": REMOTE_ID_1,
|
||||
"type": "Create",
|
||||
})
|
||||
Thing.create(
|
||||
f_id = REMOTE_ID_1,
|
||||
f_type = "Create",
|
||||
)
|
||||
|
||||
with self.assertRaisesMessage(ValueError, "Wrong parameters for thing type"):
|
||||
Thing.create({
|
||||
"id": REMOTE_ID_1,
|
||||
"actor": REMOTE_FRED,
|
||||
"type": "Create",
|
||||
})
|
||||
Thing.create(
|
||||
f_id = REMOTE_ID_1,
|
||||
f_actor = REMOTE_FRED,
|
||||
f_type = "Create",
|
||||
)
|
||||
|
||||
with self.assertRaisesMessage(ValueError, "Wrong parameters for thing type"):
|
||||
Thing.create({
|
||||
"id": REMOTE_ID_1,
|
||||
"target": REMOTE_FRED,
|
||||
"type": "Create",
|
||||
})
|
||||
Thing.create(
|
||||
f_id = REMOTE_ID_1,
|
||||
f_target = REMOTE_FRED,
|
||||
f_type = "Create",
|
||||
)
|
||||
|
||||
def test_create_create(self):
|
||||
Thing.create({
|
||||
"id": REMOTE_ID_1,
|
||||
"type": "Create",
|
||||
"actor": REMOTE_FRED,
|
||||
"object": SAMPLE_NOTE,
|
||||
})
|
||||
Thing.create(
|
||||
f_id = REMOTE_ID_1,
|
||||
f_type = "Create",
|
||||
f_actor = REMOTE_FRED,
|
||||
f_object = SAMPLE_NOTE,
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
Thing.objects.filter(remote_url=REMOTE_ID_1).count(),
|
||||
|
|
Ładowanie…
Reference in New Issue