forked from aws/aws-sam-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: init, generate_event and providers code move (aws#1685)
* refactor: Move /samcli/local/init -> /samcli/lib/init * refactor: rename @patch from 'samcli.local.init' to 'samcli.lib.init' * refactor: fixing imports after automatic refactor * refactor: fix imports for unit test * refactor: remove extra __init__.py created by pycharm during automatic move * refactor: move /samcli/commands/local/lib/generate_sample_events to /samcli/lib/generate_sample_events * refactor: move init unit tests to right folder * refactor: Move providers to lib folder * Move `samcli/commands/local/lib/*providers.py` to `samcli/lib/providers/` * Update imports * Update patch annotations * Move `InvalidLayerReference` to an exception.py file within the destination * refactor: update manifest.in
- Loading branch information
Showing
197 changed files
with
251 additions
and
261 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
include LICENSE | ||
include requirements/base.txt | ||
include requirements/dev.txt | ||
recursive-include samcli/local/init/templates * | ||
recursive-include samcli/lib/init/templates * | ||
recursive-include samcli/lib *.json | ||
recursive-include samcli/commands/local/lib/generated_sample_events *.json | ||
recursive-include samcli/lib/generated_sample_events *.json | ||
prune tests | ||
|
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
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 34 additions & 0 deletions
34
samcli/lib/init/templates/cookiecutter-aws-sam-hello-dotnet/tests/test_cookiecutter.py
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,34 @@ | ||
""" | ||
Tests cookiecutter baking process and rendered content | ||
""" | ||
|
||
|
||
def test_project_tree(cookies): | ||
result = cookies.bake(extra_context={"project_name": "hello sam"}) | ||
assert result.exit_code == 0 | ||
assert result.exception is None | ||
assert result.project.basename == "hello sam" | ||
assert result.project.isdir() | ||
assert result.project.join(".gitignore").isfile() | ||
assert result.project.join("template.yaml").isfile() | ||
assert result.project.join("README.md").isfile() | ||
assert result.project.join("src").isdir() | ||
assert result.project.join("test").isdir() | ||
assert result.project.join("src", "HelloWorld").isdir() | ||
assert result.project.join("src", "HelloWorld", "HelloWorld.csproj").isfile() | ||
assert result.project.join("src", "HelloWorld", "Function.cs").isfile() | ||
assert result.project.join("src", "HelloWorld", "aws-lambda-tools-defaults.json").isfile() | ||
assert result.project.join("test", "HelloWorld.Test", "FunctionTest.cs").isfile() | ||
assert result.project.join("test", "HelloWorld.Test", "HelloWorld.Tests.csproj").isfile() | ||
|
||
|
||
def test_app_content(cookies): | ||
result = cookies.bake(extra_context={"project_name": "my_lambda"}) | ||
app_file = result.project.join("src", "HelloWorld", "Function.cs") | ||
app_content = app_file.readlines() | ||
app_content = "".join(app_content) | ||
|
||
contents = ("GetCallingIP", "GetStringAsync", "location", "message", "hello world", "StatusCode") | ||
|
||
for content in contents: | ||
assert content in app_content |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
40 changes: 40 additions & 0 deletions
40
samcli/lib/init/templates/cookiecutter-aws-sam-hello-java-gradle/tests/test_cookiecutter.py
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,40 @@ | ||
""" | ||
Tests cookiecutter baking process and rendered content | ||
""" | ||
|
||
|
||
def test_project_tree(cookies): | ||
result = cookies.bake(extra_context={"project_name": "hello sam"}) | ||
assert result.exit_code == 0 | ||
assert result.exception is None | ||
assert result.project.basename == "hello sam" | ||
assert result.project.isdir() | ||
assert result.project.join("template.yaml").isfile() | ||
assert result.project.join("README.md").isfile() | ||
assert result.project.join("src").isdir() | ||
assert result.project.join("src", "main").isdir() | ||
assert result.project.join("src", "main", "java").isdir() | ||
assert result.project.join("src", "main", "java", "helloworld").isdir() | ||
assert result.project.join("src", "main", "java", "helloworld", "App.java").isfile() | ||
assert result.project.join("src", "main", "java", "helloworld", "GatewayResponse.java").isfile() | ||
assert result.project.join("src", "test", "java").isdir() | ||
assert result.project.join("src", "test", "java", "helloworld").isdir() | ||
assert result.project.join("src", "test", "java", "helloworld", "AppTest.java").isfile() | ||
|
||
|
||
def test_app_content(cookies): | ||
result = cookies.bake(extra_context={"project_name": "my_lambda"}) | ||
app_file = result.project.join("src", "main", "java", "helloworld", "App.java") | ||
app_content = app_file.readlines() | ||
app_content = "".join(app_content) | ||
|
||
contents = ( | ||
"package helloword", | ||
"class App implements RequestHandler<Object, Object>", | ||
"https://checkip.amazonaws.com", | ||
"return new GatewayResponse", | ||
"getPageContents", | ||
) | ||
|
||
for content in contents: | ||
assert content in app_content |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
40 changes: 40 additions & 0 deletions
40
samcli/lib/init/templates/cookiecutter-aws-sam-hello-java-maven/tests/test_cookiecutter.py
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,40 @@ | ||
""" | ||
Tests cookiecutter baking process and rendered content | ||
""" | ||
|
||
|
||
def test_project_tree(cookies): | ||
result = cookies.bake(extra_context={"project_name": "hello sam"}) | ||
assert result.exit_code == 0 | ||
assert result.exception is None | ||
assert result.project.basename == "hello sam" | ||
assert result.project.isdir() | ||
assert result.project.join("template.yaml").isfile() | ||
assert result.project.join("README.md").isfile() | ||
assert result.project.join("src").isdir() | ||
assert result.project.join("src", "main").isdir() | ||
assert result.project.join("src", "main", "java").isdir() | ||
assert result.project.join("src", "main", "java", "helloworld").isdir() | ||
assert result.project.join("src", "main", "java", "helloworld", "App.java").isfile() | ||
assert result.project.join("src", "main", "java", "helloworld", "GatewayResponse.java").isfile() | ||
assert result.project.join("src", "test", "java").isdir() | ||
assert result.project.join("src", "test", "java", "helloworld").isdir() | ||
assert result.project.join("src", "test", "java", "helloworld", "AppTest.java").isfile() | ||
|
||
|
||
def test_app_content(cookies): | ||
result = cookies.bake(extra_context={"project_name": "my_lambda"}) | ||
app_file = result.project.join("src", "main", "java", "helloworld", "App.java") | ||
app_content = app_file.readlines() | ||
app_content = "".join(app_content) | ||
|
||
contents = ( | ||
"package helloword", | ||
"class App implements RequestHandler<Object, Object>", | ||
"https://checkip.amazonaws.com", | ||
"return new GatewayResponse", | ||
"getPageContents", | ||
) | ||
|
||
for content in contents: | ||
assert content in app_content |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.