-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
get_handler_file_from_name when path contains periods (#5849)
- Loading branch information
Showing
3 changed files
with
67 additions
and
13 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
Empty file.
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,43 @@ | ||
from localstack.services.awslambda.lambda_utils import ( | ||
LAMBDA_RUNTIME_DOTNETCORE31, | ||
LAMBDA_RUNTIME_GOLANG, | ||
LAMBDA_RUNTIME_NODEJS, | ||
LAMBDA_RUNTIME_PROVIDED, | ||
LAMBDA_RUNTIME_RUBY, | ||
format_name_to_path, | ||
get_handler_file_from_name, | ||
) | ||
|
||
|
||
class TestLambdaUtils: | ||
def test_format_name_to_path(self): | ||
assert ".build/handler.js" == format_name_to_path(".build/handler.execute", ".", ".js") | ||
assert "handler" == format_name_to_path("handler.execute", ".", "") | ||
assert "CSharpHandlers.dll" == format_name_to_path( | ||
"./CSharpHandlers::AwsDotnetCsharp.Handler::CreateProfileAsync", | ||
":", | ||
".dll", | ||
) | ||
assert "test/handler.rb" == format_name_to_path("test.handler.execute", ".", ".rb") | ||
assert "test.handler.py" == format_name_to_path("./test.handler.execute", ".", ".py") | ||
assert "../handler.js" == format_name_to_path("../handler.execute", ".", ".js") | ||
|
||
def test_get_handler_file_from_name(self): | ||
assert ".build/handler.js" == get_handler_file_from_name( | ||
".build/handler.execute", LAMBDA_RUNTIME_NODEJS | ||
) | ||
assert ".build/handler" == get_handler_file_from_name( | ||
"./.build/handler.execute", LAMBDA_RUNTIME_GOLANG | ||
) | ||
assert "CSharpHandlers.dll" == get_handler_file_from_name( | ||
"./CSharpHandlers::AwsDotnetCsharp.Handler::CreateProfileAsync", | ||
LAMBDA_RUNTIME_DOTNETCORE31, | ||
) | ||
assert "test/handler.rb" == get_handler_file_from_name( | ||
"test.handler.execute", LAMBDA_RUNTIME_RUBY | ||
) | ||
assert "test.handler" == get_handler_file_from_name( | ||
"./test.handler.execute", LAMBDA_RUNTIME_GOLANG | ||
) | ||
assert "../handler.py" == get_handler_file_from_name("../handler.execute") | ||
assert "bootstrap" == get_handler_file_from_name("", LAMBDA_RUNTIME_PROVIDED) |