def test_list(self): users = [] for i in range(0, 10): users.append(_create_user(username='******' % i)) MongoSchema.clear_cache_and_init() users_from_db = User.list() for user in users_from_db: self.assertTrue(user in users)
def test_reference_query(self): user = _create_user() email = self._create_email(user) MongoSchema.clear_cache_and_init() email_from_query = Email.get(user=user) self.assertTrue(email.id == email_from_query.id) MongoSchema.clear_cache_and_init() email_from_find = [x for x in Email.find(user=user)][0] self.assertTrue(email.id == email_from_find.id)
def _setUp(): conn.drop_database(TEST_DB_NAME) MongoSchema.clear_cache_and_init()