Esempio n. 1
0
 def test_createAvatar(self):
     """
     Creates a Thing that can act on my behalf in the World
     """
     u = User(store=self.store, name=u'bojimbo')
     a = u.createAvatar()
     
     self.assertIsInstance(a, Thing)
     self.assertEqual(a.store, self.store)
     self.assertEqual(a.name, 'bojimbo')
     self.assertEqual(a.owner, u)
     actor = IActor(a)
     self.assertEqual(actor.user, u)
     self.assertEqual(actor.thing, a)
Esempio n. 2
0
 def test_avatars(self):
     """
     Should return the list of all created avatars.
     """
     u = User(store=self.store)
     self.assertEqual(list(u.avatars()), [])
     
     a1 = u.createAvatar()
     self.assertEqual(list(u.avatars()), [a1])
     
     a2 = u.createAvatar()
     them = list(u.avatars())
     self.assertTrue(a1 in them)
     self.assertTrue(a2 in them)
     self.assertEqual(len(them), 2)
     
     a2.deleteFromStore()
     self.assertEqual(list(u.avatars()), [a1])
     self.assertEqual(self.store.query(UserActor).count(), 1, "Should delete"
                      "from the store")