-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GitHub review states to have correct values
- Loading branch information
Showing
2 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
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 @@ | ||
import pytest | ||
|
||
from danger_python.models import DangerDSLJSONType, GitHubReviewState | ||
|
||
|
||
def test_github_dsl_handles_correct_review_states(): | ||
""" | ||
Test that GitHub DSL handles correct review states. | ||
""" | ||
dsl_json = { | ||
"github": { | ||
"reviews": [ | ||
{"state": "APPROVED"}, | ||
{"state": "CHANGES_REQUESTED"}, | ||
{"state": "COMMENTED"}, | ||
{"state": "PENDING"}, | ||
{"state": "DISMISSED"}, | ||
] | ||
} | ||
} | ||
|
||
dsl = DangerDSLJSONType(**dsl_json) | ||
|
||
assert len(dsl.github.reviews) == 5 | ||
assert dsl.github.reviews[0].state == GitHubReviewState.APPROVED | ||
assert dsl.github.reviews[1].state == GitHubReviewState.CHANGES_REQUESTED | ||
assert dsl.github.reviews[2].state == GitHubReviewState.COMMENTED | ||
assert dsl.github.reviews[3].state == GitHubReviewState.PENDING | ||
assert dsl.github.reviews[4].state == GitHubReviewState.DISMISSED |