def get(self): query = request.args try: res = Borrowbook.get_list(**query) if res: return jsonify(res) return make_response(jsonify({"message": "Info not found"}), 404) except Exception as e: return make_response(jsonify({"message": str(e)}), 400)
def test_get_list11(self): user11 = { "keyword": "v", "page_size": 3, "page_index": 0, "from_price": 1000, "to_price": 90000, "from_date": "2019-01-08", "to_date": "2019-12-22", "order_field": "price" } self.assertTrue(Borrowbook.get_list(**user11))
def get(self): query = request.args #page = request.args.get('page', 1, type=int) #query1 = request.args.get("pagesize") #query2 = request.args.get("pageindex") try: res = Borrowbook.get_list(query.get("keyword")) if res: return jsonify(res) return make_response(jsonify({"message": "Info not found"}), 404) except Exception as e: return make_response(jsonify({"message": str(e)}), 400)
def test_get_list10(self): user10 = { "keyword": "g", "page_size": 5, "page_index": 1, "from_price": 2000, "to_price": 100000, "from_date": "2019-01-01", "to_date": "2020-12-22", "order_field": "date" } self.assertTrue(Borrowbook.get_list(**user10))
from librarymanage.models.borrowbook import Borrowbook a = Borrowbook() user10 = {"keyword":"g", "page_size":1, "page_index":1, "from_price":2000, "to_price":100000, "from_date":"2019-01-01", "to_date":"2020-12-22", "order_field":"date"} h = a.get_list(**user10) print(h)
def test_get_list(self): self.assertTrue(Borrowbook.get_list(**user1)) self.assertTrue(Borrowbook.get_list(**user2)) self.assertTrue(Borrowbook.get_list(**user3)) self.assertTrue(Borrowbook.get_list(**user4)) self.assertTrue(Borrowbook.get_list(**user5)) self.assertTrue(Borrowbook.get_list(**user6)) self.assertTrue(Borrowbook.get_list(**user7)) self.assertTrue(Borrowbook.get_list(**user8)) self.assertTrue(Borrowbook.get_list(**user9)) self.assertTrue(Borrowbook.get_list(**user10)) self.assertTrue(Borrowbook.get_list(**user11))
def test_get_list(self): with library_mysql.atomic() as txn: Borrowbook.get_list(**user1) Borrowbook.get_list(**user2) Borrowbook.get_list(**user3) Borrowbook.get_list(**user4) Borrowbook.get_list(**user5) Borrowbook.get_list(**user6) Borrowbook.get_list(**user7) Borrowbook.get_list(**user8) Borrowbook.get_list(**user9) Borrowbook.get_list(**user10) Borrowbook.get_list(**user11) txn.rollback()
def test_get_list8(self): user8 = {"keyword": "h", "to_date": "2020-01-01"} self.assertTrue(Borrowbook.get_list(**user8))
def test_get_list7(self): user7 = {"keyword": "a", "from_date": "2019-01-01"} self.assertTrue(Borrowbook.get_list(**user7))
def test_get_list6(self): user6 = {"keyword": "v", "order_field": "price"} self.assertTrue(Borrowbook.get_list(**user6))
def test_get_list5(self): user5 = {"keyword": "a", "to_price": 60000} self.assertTrue(Borrowbook.get_list(**user5))
def test_get_list4(self): user4 = {"keyword": "v", "from_price": 2000} self.assertTrue(Borrowbook.get_list(**user4))
def test_get_list3(self): user3 = {"keyword": "v", "page_index": 3} self.assertTrue(Borrowbook.get_list(**user3))
def test_get_list2(self): user2 = {"keyword": "v", "page_size": 5} self.assertTrue(Borrowbook.get_list(**user2))
def test_get_list(self): user1 = {"keyword": "v"} self.assertTrue(Borrowbook.get_list(**user1))
def test_get_list9(self): user9 = {"keyword": "a", "from_price": 2000, "to_price": 100000} self.assertTrue(Borrowbook.get_list(**user9))