def put(self): try: """ updates a store on the DB with the given JSON values and filtered by store_id, for more information of the model refer to this project on model/store :returns example: { "success": True, "product": store_of_product } """ store = Store() json = request.json print(request.json) conditions = conditions_builder({'store_id':json['store_id']}) json.pop('store_id', None) store.update_store(json, conditions=conditions) return {'success': True, 'store': json} except Exception as e: return {'success': False, 'Error': str(e)}
def test_update_store(): store = Store() updated_values = {'store_name': 'I completely love books'} conditions = ['store_id = 1'] ans = store.update_store(updated_values, conditions=conditions) assert ans['success']