示例#1
0
def _(step, wc, department):
    with app.test_request_context():
        with app.test_client() as c:
            login('s', 's', c)
            rv = c.post('/manufacture/schedule/[%d]' % wc.id,
                        data=dict(department_id=department.id, procedure_id=1))
            assert rv.status_code == 302
示例#2
0
def _(step, node_id):
    with app.test_client() as c:
        login('cc', 'cc', c)
        node = models.Node.query.get(node_id)
        node.approve()
        assert node.approved
        assert node.work_flow.status == yawf.constants.WORK_FLOW_EXECUTED
示例#3
0
def _(step, weight, sub_order):
    with app.test_request_context():
        with app.test_client() as c:
            login('s', 's', c)
            rv = c.post('/order/work-command',
                        data=dict(sub_order_id=sub_order.id,
                                  schedule_weight=weight))
            assert rv.status_code == 302
示例#4
0
def _(step, weight, sub_order):
    with app.test_request_context():
        with app.test_client() as c:
            login('s', 's', c)
            rv = c.post('/order/work-command',
                        data=dict(sub_order_id=sub_order.id,
                                  schedule_weight=weight))
            assert rv.status_code == 302
示例#5
0
def _(step, delivery_session):
    with app.test_request_context():
        with app.test_client() as c:
            login('cc', 'cc', c)
            rv = c.post("/delivery/create-consignment-list/%s" % delivery_session.id,
                        data={"customer-pay_mod": json.dumps({customer.id: 0 for customer in
                                                              DeliverySessionWrapper(
                                                                  delivery_session).customer_list})})

            assert 302 == rv.status_code

    return models.Consignment.query.order_by(models.Consignment.id.desc()).first()
示例#6
0
def _(step, delivery_session, store_bill):
    with app.test_request_context():
        with app.test_client() as c:
            login('cc', 'cc', c)
            rv = c.post("/delivery/store-bill-list/%d" % delivery_session.id, data={"store_bill_list": store_bill.id})
            assert 302 == rv.status_code
            rv = c.post('/auth_ws/login?username=l&password=l')
            assert rv.status_code == 200
            auth_token = json.loads(rv.data)['token']
            rv = c.post("/delivery_ws/delivery-task?sid=%s&is_finished=1&remain=0&auth_token=%s" % (delivery_session.id, auth_token),
                        data=json.dumps([{"store_bill_id": store_bill.id, "is_finished": 1}]))
            assert 200 == rv.status_code
示例#7
0
def _(step, delivery_session, store_bill):
    with app.test_request_context():
        with app.test_client() as c:
            auth_token = client_login('l', 'l', c)
            rv = c.post("/delivery_ws/delivery-task?sid=%s&is_finished=1&remain=0&auth_token=%s" % (delivery_session.id, auth_token),
                        data=json.dumps([{"store_bill_id": store_bill.id, "is_finished": 1}]))
            assert 200 == rv.status_code
            delivery_task = models.DeliveryTask.query.filter(
                models.DeliveryTask.delivery_session == delivery_session).order_by(
                models.DeliveryTask.id.desc()).first()
            login('cc', 'cc', c)
            rv = c.post("/delivery/weigh-delivery-task/%d" % delivery_task.id, data={"weight": 6500})
            assert rv.status_code == 302
示例#8
0
def _(step, consignment):
    with app.test_request_context():
        with app.test_client() as c:
            login('cc', 'cc', c)
            rv = c.post("/consignment/consignment-product/%d" % consignment.product_list[0].id)
            return rv.status_code
示例#9
0
def _(step, delivery_task):
    with app.test_request_context():
        with app.test_client() as c:
            login('cc', 'cc', c)
            rv = c.post("/delivery/delivery-task/%d" % delivery_task.id)
            return rv.status_code
示例#10
0
def _(step, delivery_session):
    with app.test_request_context():
        with app.test_client() as c:
            login('cc', 'cc', c)
            rv = c.post("/delivery/delivery-session/%d" % delivery_session.id)
            assert 302 == rv.status_code
示例#11
0
def _(step, wc, department):
    with app.test_request_context():
        with app.test_client() as c:
            login('s', 's', c)
            rv = c.post('/manufacture/schedule/[%d]' % wc.id, data=dict(department_id=department.id, procedure_id=1))
            assert rv.status_code == 302