2014-09-01 61 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