This repository was archived by the owner on May 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Generating ARN strings #7
Open
mikedlr
wants to merge
2
commits into
PokaInc:master
Choose a base branch
from
mikedlr:mdd-generate-arn
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -30,3 +30,8 @@ var/ | |
| # tests artifacts | ||
| .cache | ||
| .pytest_cache | ||
|
|
||
| # editor files | ||
| *~ | ||
| .#* | ||
| \#*# | ||
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -15,3 +15,6 @@ publish-test: clean build | |
|
|
||
| publish: clean build | ||
| @twine upload --repository pypi dist/* | ||
|
|
||
| test: | ||
| python -m nose | ||
This file contains hidden or 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 hidden or 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,2 +1,3 @@ | ||
| pytest | ||
| pytest-mock | ||
| hypothesis |
This file contains hidden or 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,22 @@ | ||
| from hypothesis import given | ||
| from hypothesis.strategies import sampled_from | ||
|
|
||
| from arnparse import arnparse | ||
|
|
||
| # ARN examples from https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md | ||
| # under Apache2 license | ||
|
|
||
| arn_examples = ( | ||
| "arn:aws:serverlessrepo:us-east-1:012345678901:applications/my-application", | ||
| "arn:aws:sns:us-east-1:123456789012:my_topic", | ||
| "arn:aws:kinesis:us-east-1:123456789012:stream/my-stream", | ||
| "arn:aws:dynamodb:us-east-1:123456789012:table/TestTable/stream/2016-08-11T21:21:33.291", | ||
| "arn:aws:sqs:us-west-2:012345678901:my-queu", | ||
| "arn:aws:serverlessrepo:us-east-1:012345678901:applications/my-application", | ||
| "arn:aws:iam::123456789012:role/S3Access", | ||
| "arn:aws:s3:::my-bucket/*", | ||
| ) | ||
|
|
||
| @given(sampled_from(arn_examples)) | ||
| def test_arn_to_string(arn): | ||
| assert str(arnparse(arn)) == arn | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can achieve the same kind of functionality using pytest's parametrize without the need to involve a new testing library.