def get(self): try: """ Obtains a Product given the corresponding filters on the JSON json example: { "store_name":"Buy and sell books", } :returns example: { "success": true, "stores":[ { "store_id":1, "store_name":"Buy and sell books", "store_address": "1st Avenue", }, ... ] } """ store = Store() json = request.json ans = [] if json is not None: conditions = conditions_builder(json) ans = store.get_store(conditions) return {'success': True, 'stores': ans} except Exception as e: print(e) return {'success': False, 'Error': str(e)}
def test_get_store(): store = Store() store_info = store.get_store(conditions=['store_id = 1']) assert 'store_id' in store_info[0] and 'store_name' in store_info[0] and 'store_street' in store_info[0] and \ 'store_mail' in store_info[0] and 'store_phone_number' in store_info[0] and 'store_city' in store_info[0] and \ 'store_state' in store_info[0] and 'store_zip_code' in store_info[0]