-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from compi-migui/wip-template-validation
Add template validation command
- Loading branch information
Showing
11 changed files
with
129 additions
and
48 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
issues: | ||
- issue_type: "Story" | ||
summary: "Set up Jirate templates on my machine" | ||
# Description terminated by two newlines | ||
description: | | ||
* {*}This is a multi-line description.{*} | ||
** You can use any JIRA markup. | ||
* {*}Make sure you keep indentation consistent.{*} | ||
** This block is indented 2 spaces ahead of the "description" key. | ||
** Any additional whitespace will be part of the issue description. | ||
* {*}Termination{*}. | ||
** You can terminate multi-line strings with two newlines. | ||
subtasks: | ||
- summary: "Clone the repo and install it" | ||
description: "Description for subtask 1" | ||
- summary: "Try creating an issue from template and verify it worked" | ||
description: "Description for subtask 2" | ||
- summary: "Eat a snack as a reward for all my hard work" | ||
description: "Description for subtask 3" | ||
- issue_type: "Story" | ||
summary: "Make sure I stop using the default template" | ||
deception: "<<<----- that's not how you spell 'description'!" | ||
subtasks: | ||
- summary: "Obtain or create custom templates" | ||
description: "Description for subtask 1" | ||
- summary: "Take a well-deserved nap as a reward for all my hard work" | ||
description: "Description for subtask 2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
issues: | ||
- issue_type: "Story" | ||
summary: "Set up Jirate templates on my machine" | ||
# Description terminated by two newlines | ||
description: | | ||
* {*}This is a multi-line description.{*} | ||
** You can use any JIRA markup. | ||
* {*}Make sure you keep indentation consistent.{*} | ||
** This block is indented 2 spaces ahead of the "description" key. | ||
** Any additional whitespace will be part of the issue description. | ||
* {*}Termination{*}. | ||
** You can terminate multi-line strings with two newlines. | ||
subtasks: | ||
- summary: "Clone the repo and install it" | ||
description: "Description for subtask 1" | ||
- summary: "Try creating an issue from template and verify it worked" | ||
description: "Description for subtask 2" | ||
- summary: "Eat a snack as a reward for all my hard work" | ||
description: "Description for subtask 3" | ||
- issue_type: "Story" | ||
summary: "Make sure I stop using the default template" | ||
description: "People won't appreciate it if I keep filing the same issues over and over again." | ||
subtasks: | ||
- summary: "Obtain or create custom templates" | ||
description: "Description for subtask 1" | ||
- summary: "Take a well-deserved nap as a reward for all my hard work" | ||
description: "Description for subtask 2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from pathlib import Path | ||
from collections import namedtuple | ||
|
||
import pytest | ||
from jsonschema.exceptions import ValidationError | ||
|
||
from jirate.jira_cli import validate_template | ||
|
||
TEMPLATE_DIR = Path('jirate/tests/templates').absolute() | ||
FakeArgs = namedtuple('FakeArgs', 'template_file') | ||
|
||
|
||
def test_validate_templates_good(): | ||
# Validating a known-good template should succeed | ||
good_args = FakeArgs(template_file=f"{TEMPLATE_DIR / 'good-template.yaml'}") | ||
validate_template(good_args) | ||
|
||
|
||
def test_validate_templates_bad(): | ||
# Validating a known-bad template should fail | ||
bad_args = FakeArgs(template_file=f"{TEMPLATE_DIR / 'bad-template.yaml'}") | ||
with pytest.raises(ValidationError): | ||
validate_template(bad_args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ jira>=3.6.0 | |
python-dateutil | ||
toolchest | ||
prettytable | ||
jsonschema>=4.18.0a1 | ||
referencing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
jsonschema>=4.18.0a1 | ||
pytest | ||
referencing |