def setUp(self): drop_database() create_database() User('Daniel Machado Castillo', '*****@*****.**', '+573138966044', 'Freqm0d+', 1).add_item() User('Yoshi Restall', '*****@*****.**', '926-587-9732', 'Freqm0d+', 1).add_item()
def setUp(self): drop_database() create_database() save_test_data('usuarios.csv', User) save_test_data('almacen.csv', Store) save_test_data('categoria_producto.csv', ProductCategory) save_test_data('fabricante.csv', Brand) save_test_data('productos.csv', Product) pass
def setUp(self): drop_database() create_database() Brand('Aldy', '').add_manufacturer() categories = [ 'Mercado', 'Alimentos', 'Despensa', 'Azúcar, panela y endulzante', 'Endulzantes' ] for category in categories: parent_index = categories.index(category) - 1 if parent_index < 0: parent = None else: parent_name = categories[parent_index] parent = get_product_category_id(parent_name) ProductCategory(parent, category).add_product_category() Product( 5, 1, 'Endulzante Aldy X 200 Gramos', '258974', 1, ).add_product() Product( 5, 1, 'Endulzante Aldy X 201 Gramos', '258975', 1, ).add_product() Product( 5, 1, 'Endulzante Aldy X 202 Gramos', '258976', 1, ).add_product() Product( 5, 1, 'Endulzante Aldy X 203 Gramos', '258977', 1, ).add_product() Product( 5, 1, 'Endulzante Aldy X 205 Gramos', '258978', 1, ).add_product()
def setUp(self): drop_database() create_database()
def tearDown(self): drop_database()
# return True, mssg # if not (0 <= int(until_hour) <= 23): # mssg = [400, {'message': 'Error en los parámetros suministrados', # 'action': 'El rango de valores 0-23'}] # return True, mssg # if not (0 <= int(until_minutes) <= 59): # mssg = [400, {'message': 'Error en los parámetros suministrados', # 'action': 'El rango de valores 0-59'}] # return True, mssg s.add(self) s.commit() return {'success': True}, 200, {'ContentType': 'application/json'} def check_schedule_exists_by_warehouse(warehouse, day): if not warehouse: raise InvalidArgument('El campo warehouse no puede estar vacio o nulo') if not day: raise InvalidArgument('El campo day no puede estar vacio o nulo') if s.query(StoreHours).filter( and_(StoreHours.store_id == warehouse, StoreHours.day == day)).first(): raise ResourceConflict( 'Este horario ya se encuentra asociado al almacen') return {'success': True}, 200, {'ContentType': 'application/json'} if __name__ == '__main__': from dbmodel.database_init import drop_database, create_database drop_database()
def setUp(self): pass drop_database() create_database() save_test_data('usuarios.csv', User) save_test_data('almacen.csv', Store) save_test_data('categoria_producto.csv', ProductCategory) save_test_data('fabricante.csv', Brand) save_test_data('productos.csv', Product) test_user_1 = get_user_by_mail('*****@*****.**') test_warehouse_1 = get_warehouse_by_name('Snaptags') test_warehouse_member_1 = StoreEmployee(test_user_1.id_usuario, test_warehouse_1.id_almacen) test_user_2 = get_user_by_mail('*****@*****.**') test_warehouse_2 = get_warehouse_by_name('Latz') test_warehouse_member_2 = StoreEmployee(test_user_2.id_usuario, test_warehouse_2.id_almacen) test_user_3 = get_user_by_mail('*****@*****.**') test_warehouse_3 = get_warehouse_by_name('Twinte') test_warehouse_member_3 = StoreEmployee(test_user_3.id_usuario, test_warehouse_3.id_almacen) test_warehouse_member_1.add_warehouse_member(test_user_1.id_usuario) test_warehouse_member_2.add_warehouse_member(test_user_2.id_usuario) test_warehouse_member_3.add_warehouse_member(test_user_3.id_usuario) inventory_test_1 = Stock(1, test_warehouse_1.id_almacen, 1100) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_1.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(2, test_warehouse_1.id_almacen, 2100) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_1.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(3, test_warehouse_1.id_almacen, 3100) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_1.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(4, test_warehouse_1.id_almacen, 4100) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_1.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(5, test_warehouse_1.id_almacen, 5100) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_1.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(6, test_warehouse_1.id_almacen, 6100) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_1.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(7, test_warehouse_1.id_almacen, 7100) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_1.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(8, test_warehouse_1.id_almacen, 8100) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_1.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(9, test_warehouse_1.id_almacen, 9100) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_1.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(10, test_warehouse_1.id_almacen, 10100) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_1.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(1, test_warehouse_2.id_almacen, 1200) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_2.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(2, test_warehouse_2.id_almacen, 2200) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_2.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(3, test_warehouse_2.id_almacen, 3200) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_2.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(4, test_warehouse_2.id_almacen, 4200) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_2.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(5, test_warehouse_2.id_almacen, 5200) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_2.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(6, test_warehouse_2.id_almacen, 6200) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_2.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(7, test_warehouse_2.id_almacen, 7200) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_2.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(8, test_warehouse_2.id_almacen, 8200) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_2.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(9, test_warehouse_2.id_almacen, 9200) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_2.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(10, test_warehouse_2.id_almacen, 10200) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_2.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(1, test_warehouse_3.id_almacen, 1300) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_3.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(2, test_warehouse_3.id_almacen, 2300) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_3.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(3, test_warehouse_3.id_almacen, 3300) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_3.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(4, test_warehouse_3.id_almacen, 4300) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_3.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(5, test_warehouse_3.id_almacen, 5300) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_3.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(6, test_warehouse_3.id_almacen, 6300) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_3.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(7, test_warehouse_3.id_almacen, 7300) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_3.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(8, test_warehouse_3.id_almacen, 8300) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_3.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(9, test_warehouse_3.id_almacen, 9300) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_3.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() inventory_test_1 = Stock(10, test_warehouse_3.id_almacen, 10300) inventory_test_1.add_item() StockInput(inventory_test_1.stock_item_id, test_warehouse_member_3.store_employee_id, 10, datetime.datetime.now()).add_inventory_input() DynamicBasket(test_user_1.id_usuario, 1, 5).add_item() DynamicBasket(test_user_1.id_usuario, 2, 5).add_item() DynamicBasket(test_user_1.id_usuario, 3, 5).add_item() DynamicBasket(test_user_1.id_usuario, 4, 5).add_item() DynamicBasket(test_user_1.id_usuario, 5, 5).add_item() DynamicBasket(test_user_1.id_usuario, 6, 5).add_item() DynamicBasket(test_user_1.id_usuario, 7, 5).add_item() DynamicBasket(test_user_1.id_usuario, 8, 5).add_item() DynamicBasket(test_user_1.id_usuario, 9, 5).add_item() DynamicBasket(test_user_1.id_usuario, 10, 5).add_item() StandardBasket(test_user_1.id_usuario, 1, 5).add_item() StandardBasket(test_user_1.id_usuario, 2, 5).add_item() StandardBasket(test_user_1.id_usuario, 3, 5).add_item() StandardBasket(test_user_1.id_usuario, 4, 5).add_item() StandardBasket(test_user_1.id_usuario, 5, 5).add_item() StandardBasket(test_user_1.id_usuario, 6, 5).add_item() StandardBasket(test_user_1.id_usuario, 7, 5).add_item() StandardBasket(test_user_1.id_usuario, 8, 5).add_item() StandardBasket(test_user_1.id_usuario, 9, 5).add_item() StandardBasket(test_user_1.id_usuario, 10, 5).add_item()