2016-07-20 2 views
1

나는 조롱과 함께 단위 테스트에 관한 많은 기사를 보았습니다.Django Behave 테스트를 조롱하는 것이 가능합니까?

카드 결제 세부 정보를 결제 게이트웨이에 제출하는 간단한 결제 양식이 있습니다. Behave tests에서 지불 게이트웨이 응답을 조롱하는 것이 가능합니까?

@then(u'I submitted checkout form') 
def submit_checkout_form(context): 
    "Mock your response Do not send/post request to payment gateway, but create order" 

@then(u'I see my order successfully created') 
def inspect_order_page(context): 
    "Thank you page: check product & price" 

나는 행동 테스트를 조롱 할 수 있습니까?

답변

0

당신이 시도 할 수 :

@then(u'I submitted checkout form') 
def submit_checkout_form(context): 
    with mock.patch('path.module', mock.Mock(return_value=None)): 
     **type here** 
관련 문제