lundi 1 septembre 2014

How to have multiline step definitions calling other multiline step definitions


Vote count:

0




Attempting to call a multiline step definition from another multiline step definition. The lettuce.py website has little to say on the matter.



@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 ) )


asked 1 min ago







How to have multiline step definitions calling other multiline step definitions

Aucun commentaire:

Enregistrer un commentaire