def test_activity_with_local_user(self): act = activity.send(self.user, 'follow', self.user) self.assertEqual('http://activitystrea.ms/schema/1.0/follow', act.verb) self.assertFalse(act.actor.is_remote()) self.assertEqual(self.user, act.actor.user) self.assertEqual(self.user, act.object) self.assertEqual(self.user.username, act.actor.username) self.assertEqual(self.user.email, act.actor.email) self.assertEqual(self.user.username, act.actor.name)
def test_activity_with_remote_actor(self): actor = dict( name='paulosman', uri='http://paulosman.status.net/user/1', ) object = dict( type='http://activitystrea.ms/schema/1.0/person', ) verb = 'http://activitystrea.ms/schema/1.0/follow' act = activity.send(actor, verb, object) self.assertEqual(verb, act.verb) self.assertTrue(act.actor.is_remote()) self.assertEqual(actor['name'], act.actor.username) self.assertEqual(actor['uri'], act.actor.uri) self.assertEqual(object['type'], act.object.type) self.assertEqual(actor['name'], act.actor.name)
def test_remote_target_missing_type(self): self.assertRaises(activity.ActivityError, lambda: activity.send(dict(name='Paul'), 'follow', dict(uri='http://example.com')))