From 56ce26a72809a7e7b56c56002e843e406b2dfd46 Mon Sep 17 00:00:00 2001 From: Nuwan Goonasekera Date: Thu, 4 Jan 2018 15:31:17 +0530 Subject: [PATCH] Added support for filtering AMIs by self (#1398) * Added support for filtering AMIs by self Closes: https://github.com/spulec/moto/issues/1396 * Adjusted regex to also match signature v4 and fixed py3 compatibility --- moto/core/responses.py | 16 ++++++++++++++++ moto/ec2/models.py | 15 +++++++++++---- moto/ec2/responses/amis.py | 5 +++-- tests/test_ec2/test_amis.py | 14 ++++++++++++++ 4 files changed, 44 insertions(+), 6 deletions(-) diff --git a/moto/core/responses.py b/moto/core/responses.py index ae91cdc02..5afe5e168 100644 --- a/moto/core/responses.py +++ b/moto/core/responses.py @@ -108,6 +108,7 @@ class BaseResponse(_TemplateEnvironmentMixin): # to extract region, use [^.] region_regex = re.compile(r'\.(?P[a-z]{2}-[a-z]+-\d{1})\.amazonaws\.com') param_list_regex = re.compile(r'(.*)\.(\d+)\.') + access_key_regex = re.compile(r'AWS.*(?P(?