-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add filter alias support to layer/subscription commands (#70)
* Add alias support to layer/subscription commands Closes #69 * Add test for get_aliased_functions
- Loading branch information
Showing
8 changed files
with
163 additions
and
24 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import boto3 | ||
import mock | ||
from moto import mock_lambda | ||
from newrelic_lambda_cli.functions import get_aliased_functions | ||
|
||
|
||
@mock_lambda | ||
@mock.patch("newrelic_lambda_cli.functions.list_functions", autospec=True) | ||
def test_get_aliased_functions(mock_list_functions, aws_credentials): | ||
""" | ||
Asserts that get_aliased_functions adds functions matching one of the alias filters | ||
""" | ||
session = boto3.Session(region_name="us-east-1") | ||
|
||
assert get_aliased_functions(session, [], []) == [] | ||
assert get_aliased_functions(session, ["foo"], []) == ["foo"] | ||
assert get_aliased_functions(session, ["foo", "bar"], ["bar"]) == ["foo"] | ||
assert get_aliased_functions(session, ["foo", "bar", "baz"], ["bar"]) == [ | ||
"foo", | ||
"baz", | ||
] | ||
|
||
mock_list_functions.return_value = [{"FunctionName": "aliased-func"}] | ||
assert get_aliased_functions(session, ["foo", "bar", "all"], []) == [ | ||
"foo", | ||
"bar", | ||
"aliased-func", | ||
] | ||
|
||
mock_list_functions.return_value = [ | ||
{"FunctionName": "aliased-func"}, | ||
{"FunctionName": "ignored-func"}, | ||
{"FunctionName": "newrelic-log-ingestion"}, | ||
] | ||
assert get_aliased_functions(session, ["foo", "bar", "all"], ["ignored-func"]) == [ | ||
"foo", | ||
"bar", | ||
"aliased-func", | ||
] |