2014-09-01 90 views
-1

嘗試從另一個多行步驟定義調用多行步驟定義。關於這個問題,lettuce.py網站對於say幾乎沒有什麼限制。如何讓多行步驟定義調用其他多行步驟定義

@step(u'I create a "([^"]*)" with the definition:$') 
    def i_create_a_resource_with_the_definition(step, resource): 
     body = "" 

     if step.multiline != "": 
      definition = json.loads(step.multiline) 
      body = json.dumps(definition) 

     url = world.url + "/" + resource + "s" 

     world.response = world.perform_http_request(url = url, method = "POST", body = body) 

@step(u'I create a duplicate "([^"]*)" with the definition:$') 
    def i_create_a_duplicate_resource_with_the_definition(step, resource): 
     step.behave_as(""" 
      I create a "{resource}" with the definition: 
     """.format(resource = resource)) 

回答

0

這個問題是product有關。

這應該在infoxchange/new-parser分支中修復。 - Danielle Madeley

0

雖然沒有真正回答這個問題。我們繼續使用以下步驟定義的時刻:

@step(u'I "([^"]*)" (a|a duplicate) "([^"]*)" with the definition:$') 
def i_method_a_resource_with_the_definition(step, method, word, resource): 
    body = "" 

    if step.multiline != "": 
     definition = json.loads(step.multiline) 
     body = json.dumps(definition) 

    url = world.url + "/" + resource + "s" 

    world.response = world.perform_http_request(url = url, method = method, body = body) 

    if "location" in world.response.headers: 
     world.last_resource_identifier = world.response.headers[ "location" ] 

並提出與開發商的issue