def test_parsing_files_with_many_scenarios_returns_parsed_scenarios(): class DoSomethingAction(ActionBase): regex = r'I do something$' def execute(context, *args, **kwargs): pass class DoSomethingElseAction(ActionBase): regex = r'I do something else$' def execute(context, *args, **kwargs): pass class DoYetAnotherThingAction(ActionBase): regex = r'I do yet another thing$' def execute(context, *args, **kwargs): pass settings = Settings() settings.tests_dirs = [abspath(dirname(__file__))] settings.file_pattern = "some_test.acc" parser = FileParser() fixture = parser.get_stories(settings=settings) assert_no_invalid_stories(fixture) assert len(fixture.stories) == 1, "Expected 1, Actual: %d" % len(fixture.stories) assert len(fixture.stories[0].scenarios) == 2 assert "#some custom comment" in fixture.stories[0].scenarios[1].whens[0].description
def test_parsing_files_with_many_scenarios_returns_parsed_scenarios(): class DoSomethingAction(ActionBase): regex = r'I do something$' def execute(context, *args, **kwargs): pass class DoSomethingElseAction(ActionBase): regex = r'I do something else$' def execute(context, *args, **kwargs): pass class DoYetAnotherThingAction(ActionBase): regex = r'I do yet another thing$' def execute(context, *args, **kwargs): pass settings = Settings() settings.tests_dirs = [abspath(dirname(__file__))] settings.file_pattern = "some_test.acc" parser = FileParser() fixture = parser.get_stories(settings=settings) assert_no_invalid_stories(fixture) assert len( fixture.stories) == 1, "Expected 1, Actual: %d" % len(fixture.stories) assert len(fixture.stories[0].scenarios) == 2 assert "#some custom comment" in fixture.stories[0].scenarios[1].whens[ 0].description
def test_parsing_files_with_wrong_so_that_returns_no_story_header_list(): settings = Settings() settings.tests_dirs = [abspath(join(dirname(__file__), "invalid_content_stories"))] settings.file_pattern = "invalid_so_that.acc" parser = FileParser() fixture = parser.get_stories(settings=settings) assert len(fixture.no_story_header) == 1 file_path = fixture.no_story_header[0] assert file_path.endswith("invalid_so_that.acc")
def test_parsing_files_with_wrong_i_want_to_returns_no_story_header_list(): settings = Settings() settings.tests_dirs = [ abspath(join(dirname(__file__), "invalid_content_stories")) ] settings.file_pattern = "invalid_i_want_to.acc" parser = FileParser() fixture = parser.get_stories(settings=settings) assert len(fixture.no_story_header) == 1 file_path = fixture.no_story_header[0] assert file_path.endswith("invalid_i_want_to.acc")