Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
3.1 kB
2
Indexable
Never
def test_pvz_mono_packing(api, timeslotinfo, db, kraken_order_manager, user_client_id):
    with allure.step(
            f'cоздаем постинги'):
        wh = Warehouse_9833
        pvz_name = "Пункт выдачи OZON г. Москва, наб. Пресненская, д. 10 блок C"
        address = Address('г. Москва, наб. Пресненская, д. 10 блок C')
        timeslot = timeslotinfo.get_time_slots_for_pvz(pvz_name).get_ts_that_start_after_minutes(10).earliest
        foot_dimension = Dimensions(5000, 750, 450, 380)  # noqa FKA01
        item_kiz_id = int(db.rezon.get_kiz_items_on_wh_by_rezonwh_id(wh.rezon_id)[3]["sku"])
        item_not_kiz_id = int(db.rezon.get_not_kiz_items_on_wh_by_rezonwh_id(wh.rezon_id)[6]["sku"])

        item_kiz = Item(item_kiz_id, 3, foot_dimension, delivery_schema='FBS')  # noqa FKA01
        item_not_kiz = Item(item_not_kiz_id, 3, foot_dimension, delivery_schema='FBS')  # noqa FKA01

        posting = [Posting(address, [item_kiz, item_not_kiz], timeslot, wh, delivery_type='PVZ',  # noqa FKA01
                            delivery_schema='FBS')]

        posting1 = [Posting(address, [item_kiz], timeslot, wh, delivery_type='PVZ',  # noqa FKA01
                            delivery_schema='FBS')]
        posting2 = [Posting(address, [item_not_kiz], timeslot, wh, delivery_type='PVZ',  # noqa FKA01
                            delivery_schema='FBS')]
        order = KrakenOrder(postings=posting,
                             warehouse=wh,
                             client_id=user_client_id,
                             delivery_type='PVZ',
                             delivery_schema='FBS')
        order1 = KrakenOrder(postings=posting1,
                             warehouse=wh,
                             client_id=user_client_id,
                             delivery_type='PVZ',
                             delivery_schema='FBS')
        order2 = KrakenOrder(postings=posting2,
                             warehouse=wh,
                             client_id=user_client_id,
                             delivery_type='PVZ',
                             delivery_schema='FBS')

        order = kraken_order_manager.create_and_pay_order(order, check_pay=False)
        order1 = kraken_order_manager.create_and_pay_order(order1, check_pay=False)
        order2 = kraken_order_manager.create_and_pay_order(order2, check_pay=False)

        for posting in order.postings:
            new_timeslot = (datetime.now() + timedelta(hours=2)).strftime("%Y-%m-%d %H:00:00.") + '000'
            db.rezon.update_posting_timeslot_by_posting_number(posting.number, new_timeslot)
        for posting in order1.postings:
            new_timeslot = (datetime.now() + timedelta(hours=2)).strftime("%Y-%m-%d %H:00:00.") + '000'
            db.rezon.update_posting_timeslot_by_posting_number(posting.number, new_timeslot)
        for posting in order2.postings:
            new_timeslot = (datetime.now() + timedelta(hours=2)).strftime("%Y-%m-%d %H:00:00.") + '000'
            db.rezon.update_posting_timeslot_by_posting_number(posting.number, new_timeslot)