def step_impl(context, user): order = steps_db_util.get_latest_order() context.latest_order_id = order.id # client = context.client response = context.client.get('/mall2/order/?order_id=%d' % context.latest_order_id) order = response.context['order'] order.order_no = order.order_id # order.order_type = ORDER_TYPE2TEXT[order.type] order.order_type = '' order.total_price = float(order.final_price) order.ship_area = order.area # + ' ' + order.ship_address order.actions = get_order_action_set(order.actions) for product in order.products: product['price'] = float(product['price']) order.status = STATUS2TEXT[order.status] for product in order.products: if 'custom_model_properties' in product and product[ 'custom_model_properties']: product['model'] = ' '.join([ property['property_value'] for property in product['custom_model_properties'] ]) product['supplier'] = product.get('supplier_name', '') product['status'] = product.get('order_status', '') actual = order actual.reason = order.reason expected = json.loads(context.text) expected['order_type'] = '' if 'actions' in expected: expected['actions'] = set(expected['actions']) bdd_util.assert_dict(expected, actual)
def step_impl(context, webapp_owner_name): db_order = steps_db_util.get_latest_order() response = context.client.get('/mall2/order/?order_id=%d' % db_order.id, follow=True) order = response.context['order'] expected = json.loads(context.text) bdd_util.assert_dict(expected, order)
def step_impl(context, user): db_order = steps_db_util.get_latest_order() response = context.client.get('/mall/order/', { 'woid': context.client.woid, 'order_id': db_order.order_id }) order = response.body['data']['order'] expected = json.loads(context.text) bdd_util.assert_dict(expected, order)
def step_impl(context, user, action): if hasattr(context, 'latest_order_id'): try: latest_order_no = Order.objects.get( id=context.latest_order_id).order_id except: latest_order_no = Order.objects.get( order_id=context.latest_order_id).order_id else: latest_order_no = steps_db_util.get_latest_order().order_id context.execute_steps(u"when %s'%s'订单'%s'" % (user, action, latest_order_no))
def step_impl(context, member, is_can): client = context.client pay_result = context.pay_result is_show_red_envelope = pay_result['is_show_red_envelope'] if is_show_red_envelope: red_envelope_rule_id = pay_result['red_envelope_rule_id'] order = steps_db_util.get_latest_order() url = '/workbench/jqm/preview/?module=market_tool:share_red_envelope&model=share_red_envelope&action=get&webapp_owner_id=%s&order_id=%s&red_envelope_rule_id=%s&fmt=%s' % (context.webapp_owner_id, order.id, red_envelope_rule_id, context.member.token) url = bdd_util.nginx(url) context.red_envelope_url = url response = context.client.get(url) context.tc.assertEquals(is_show_red_envelope, is_can2code[is_can])
def step_impl(context, user): # TODO 废弃这个方法,改用 @when(u'{user}对订单进行发货') if hasattr(context, 'latest_order_id'): try: latest_order_no = Order.objects.get(id=context.latest_order_id).id except: latest_order_no = Order.objects.get( order_id=context.latest_order_id).id else: latest_order_no = steps_db_util.get_latest_order().id url = '/mall2/api/delivery/' data = { 'order_id': latest_order_no, 'express_company_name': 'shentong', 'express_number': '123456789', 'leader_name': user, 'is_update_express': 'false' } response = context.client.post(url, data)