Пример #1
0
 def post(self):
     try:
         """
         inserts a store on the DB given by the JSON, 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
         store.insert_store(json)
         return {'success': True, 'store': json}
     except Exception as e:
         return {'success': False, 'Error': str(e)}
Пример #2
0
def test_insert_store():
    store = Store()
    store_to_db = {
        'store_name': 'book seller No. 1',
        'store_street': '5th Avenue',
        'store_mail': '*****@*****.**',
        'store_phone_number': '5522887799',
        'store_city': 'City 1',
        'store_state': 'State 1',
        'store_zip_code': '99999',
    }
    ans = store.insert_store(store_to_db)
    assert ans['success']