예제 #1
0
 def delete(self):
     s = User()
     query = request.args
     try:
         res = s.deleteUser(query.get("id_user"))
         if res:
             return jsonify(res)
         return make_response(jsonify({"message": "OK"}), 200)
     except Exception as e:
         return make_response(jsonify({"message": str(e)}), 400)
예제 #2
0
 def put(self):
     query = request.get_json()
     try:
         id_ = User.updateUser(**query)
         if id_:
             res = User.search_by_id_user(id_)
             return make_response(jsonify({"data": res}), 201)
         return make_response(jsonify({"message": "ok"}), 200)
     except Exception as e:
         return make_response(jsonify({"message": str(e)}), 400)
예제 #3
0
 def get(self):
     query = request.args
     try:
         res = User.get_list_user(**query)
         if res:
             return jsonify(res)
         return make_response(jsonify({"message": "User not found"}), 404)
     except Exception as e:
         return make_response(jsonify({"message": str(e)}), 400)
예제 #4
0
 def get(self):
     query = request.args
     try:
         res = User.search_by_id_user(query.get("id_user"))
         if res:
             return jsonify(res)
         return make_response(jsonify({"message": " Not Found"}), 404)
     except Exception as e:
         return make_response(jsonify({"message": str(e)}), 400)
예제 #5
0
 def test_get_list(self):
     self.assertTrue(User.get_list_user(**User5))
     self.assertTrue(User.get_list_user(**User6))
     self.assertTrue(User.get_list_user(**User7))
     self.assertTrue(User.get_list_user(**User8))
     self.assertTrue(User.get_list_user(**User9))
     self.assertTrue(User.get_list_user(**User10))
     self.assertTrue(User.get_list_user(**User11))
예제 #6
0
 def test_create(self):
     self.assertTrue(User.createUser(**User1))
     self.assertTrue(User.createUser(**User2))
예제 #7
0
 def test_search(self):
     self.assertTrue(User.search_by_id_user(3))
     self.assertTrue(User.search_by_id_user(7))
예제 #8
0
 def test_delete(self):
     self.assertTrue(User.deleteUser(1))
     self.assertTrue(User.deleteUser(5))
예제 #9
0
 def test_update(self):
     self.assertTrue(User.updateUser(**User3))
     self.assertTrue(User.updateUser(**User4))
예제 #10
0
 def test_create_user(self):
     with library_mysql.atomic() as txn:
         User.createUser(**User1)
         User.createUser(**User2)
         txn.rollback()
예제 #11
0
 def test_get_list_user(self):
     with library_mysql.atomic() as txn:
         User.get_list_user(**User5)
         User.get_list_user(**User6)
         User.get_list_user(**User7)
         User.get_list_user(**User8)
         User.get_list_user(**User9)
         User.get_list_user(**User10)
         User.get_list_user(**User11)
         txn.rollback()
예제 #12
0
 def test_search_user(self):
     with library_mysql.atomic() as txn:
         User.search_by_id_user(3)
         User.search_by_id_user(7)
         txn.rollback()
예제 #13
0
 def test_delete_user(self):
     with library_mysql.atomic() as txn:
         User.deleteUser(1)
         User.deleteUser(5)
         txn.rollback()
예제 #14
0
 def test_update_user(self):
     with library_mysql.atomic() as txn:
         User.updateUser(**User3)
         User.updateUser(**User4)
         txn.rollback()