def test_update(self):
        user_db.sync_user(USER, USER_ID, self.callback)
        result, error = self.wait()
        self.assertIs(error, None)
        self.assertIsNot(result, None)

        user_db.update({"$set": {
            "name": "updated_name"
        }}, USER_ID, self.callback)
        result, error = self.wait()
        self.assertIs(error, None)
        self.assertEqual(result["name"], "updated_name")
    def test_update(self):
        user_db.sync_user(USER, USER_ID, self.callback)
        result, error = self.wait()
        self.assertIs(error, None)
        self.assertIsNot(result, None)

        user_db.update(
            { "$set": { "name": "updated_name" } },
            USER_ID,
            self.callback
        )
        result, error = self.wait()
        self.assertIs(error, None)
        self.assertEqual(result["name"], "updated_name")
Esempio n. 3
0
    def update(self, update_user):
        @mongo_callback(self)
        def update_callback(result):
            self.respond(result)

        UserDB.update({ "$set": update_user }, self.user_id, update_callback)