Skip to content

Commit 499bd9d

Browse files
committed
implement and extend steps for "create an issue" scenario
the "create an issue" step is needed as well as some crude pattern matching in the output expectation
1 parent f94229c commit 499bd9d

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

behave/issue_list_create.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Feature: Creating and listing issues
66
Then it prints "total: 0 issues"
77
And terminates with exit code OK
88

9-
@skip
9+
@wip
1010
Scenario: create an issue
1111
Given an empty issue repository
1212
When we create an issue titled "My first issue in Fix" with description

behave/steps/fix_cli.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from behave import given, when, then
22
from assertions import *
33
import pexpect
4+
import shlex
45

56
fix_executable = '../cmake-build-debug/bin/fix'
67

@@ -11,7 +12,7 @@ def _start_fix_with_args(context, args):
1112

1213
@when(u'we call Fix with argument list "{args}"')
1314
def start_fix(context, args):
14-
_start_fix_with_args(context, args.strip().split(" "))
15+
_start_fix_with_args(context, shlex.split(args.strip(), posix=False))
1516

1617

1718
@when(u'we call Fix without arguments')
@@ -21,7 +22,9 @@ def start_fix_no_args(context):
2122

2223
@then(u'it prints "{output}"')
2324
def check_output(context, output):
24-
context.fix.expect_exact(output)
25+
pattern = output.replace("[hash]", "[0-9a-f]{7}")
26+
if pattern != output: context.fix.expect(pattern)
27+
else: context.fix.expect_exact(output)
2528

2629

2730
@then(u'it prints usage information')

behave/steps/fix_issues.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ def empty_repository(context):
88
@when(u'we list all issues')
99
def list_issues(context):
1010
fix_cli.start_fix(context, "list")
11+
12+
@when(u'we create an issue titled "{title}" with description')
13+
def create_issue(context, title):
14+
description=context.text or ""
15+
fix_cli.start_fix(context, f'create --title "{title}" --descr "{description}"')

0 commit comments

Comments
 (0)