def complete_scenario_with_then_action_returned(): story = Story(as_a="Someone", i_want_to="Do Something", so_that="I'm Happy", identity="Some file") scenario = story.append_scenario("1", "Something") given = scenario.add_given(action_description="I did something", execute_function=lambda: None, args=["s"], kwargs={"a":"b"}) when = scenario.add_when(action_description="I do something", execute_function=lambda: None, args=["s"], kwargs={"a":"b"}) then = scenario.add_then(action_description="Something happens", execute_function=lambda: None, args=["s"], kwargs={"a":"b"}) return then
def some_action(): story = Story(as_a="Someone", i_want_to="Do Something", so_that="I'm Happy", identity="some file") scenario = story.append_scenario("1", "Something") return scenario.add_given(action_description="Some Action", \ execute_function=lambda context, *args, **kwargs: None, \ args=["s"], \ kwargs={"a":"b"})
def some_action(): story = Story(as_a="Someone", i_want_to="Do Something", so_that="I'm Happy", identity="Some file") scenario = story.append_scenario("1", "Something") return scenario.add_given(action_description="Some Action", execute_function=lambda: None, args=["s"], kwargs={"a": "b"})
def some_action(): story = Story(as_a="Someone", i_want_to="Do Something", so_that="I'm Happy", identity="some file") scenario = story.append_scenario("1", "Something") def execute_action(context, *args, **kwargs): return None return scenario.add_given(action_description="Some Action", \ execute_function=execute_action, \ args=["s"], \ kwargs={"a":"b"})
def complete_scenario_with_then_action_returned(): story = Story(as_a="Someone", i_want_to="Do Something", so_that="I'm Happy", identity="some file") scenario = story.append_scenario("1", "Something") given = scenario.add_given(action_description="I did something", execute_function=lambda: None, args=["s"], kwargs={"a": "bs"}) when = scenario.add_when(action_description="I do something", execute_function=lambda: None, args=["s"], kwargs={"a": "b"}) then = scenario.add_then(action_description="Something happens", execute_function=lambda: None, args=["s"], kwargs={"a": "b"}) return then
def test_append_scenario_adds_right_index_to_scenarios_in_story(): story = Story(as_a="Someone", i_want_to="Do Something", so_that="I'm Happy", identity="Some File") story.append_scenario(index="1", title="Test") assert story.scenarios[0].index == "1", "There should be a scenario in the story with index 1 but there was %s" % story.scenarios[0].index
def test_append_scenario_adds_right_class_to_scenarios_in_story(): story = Story(as_a="Someone", i_want_to="Do Something", so_that="I'm Happy", identity="Some File") story.append_scenario(index="1", title="Test") assert isinstance(story.scenarios[0], Scenario), "There should be an item of class Scenario in the story but there was %s" % story.scenarios[0].__class__
def test_append_scenario_adds_to_scenarios_in_story(): story = Story(as_a="Someone", i_want_to="Do Something", so_that="I'm Happy", identity="Some File") story.append_scenario(index="1", title="Test") assert len(story.scenarios) == 1, "There should be one scenario in the story but there was %d" % len(story.scenarios)