Skip to content

Commit

Permalink
implement steps for "created issues are listed" scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
arnemertz committed Aug 17, 2021
1 parent 3a72ef9 commit ec7cc44
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion behave/issue_list_create.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Feature: Creating and listing issues
Then it prints "Issue created: my-fir-iss-in-[hash]"
And terminates with exit code OK

@skip
@wip
Scenario: created issues are listed in alphabetic order by ID
Given an empty issue repository
When we create an issue titled "The first created issue" with description
Expand Down
6 changes: 4 additions & 2 deletions behave/steps/fix_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ def start_fix_no_args(context):
@then(u'it prints "{output}"')
def check_output(context, output):
pattern = output.replace("[hash]", "[0-9a-f]{7}")
if pattern != output: context.fix.expect(pattern)
else: context.fix.expect_exact(output)
if pattern != output:
context.fix.expect(pattern)
else:
context.fix.expect_exact(output)


@then(u'it prints usage information')
Expand Down
24 changes: 22 additions & 2 deletions behave/steps/fix_issues.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,35 @@
from behave import given, when, then
import fix_cli


@given(u'an empty issue repository')
def empty_repository(context):
pass


@when(u'we list all issues')
def list_issues(context):
fix_cli.start_fix(context, "list")


def _create_issue(context, title, description):
fix_cli.start_fix(context, f'create --title "{title}" --descr "{description}"')


@when(u'we create an issue titled "{title}" with description')
def create_issue(context, title):
description=context.text or ""
fix_cli.start_fix(context, f'create --title "{title}" --descr "{description}"')
description = context.text or ""
_create_issue(context, title, description)


@when(u'we create an issue titled "{title}"')
def create_issue_random_description(context, title):
description = "Dorem Fixum dolor sit amet..."
_create_issue(context, title, description)


@then(u'it prints a list of issues')
def check_issue_list(context):
context.fix.expect(r'ID\W+STATUS\W+TITLE')
for row in context.table:
fix_cli.check_output(context, f'{row["issue ID prefix"]}-[hash]\\W+{row["status"]}\\W+"{row["title"]}"')

0 comments on commit ec7cc44

Please sign in to comment.