From 24f83e91f26f95c27877a7049ecceda422f0944a Mon Sep 17 00:00:00 2001 From: Waldemar Hummer Date: Wed, 27 Dec 2017 22:58:24 -0500 Subject: [PATCH] return 404 error on missing action --- moto/core/responses.py | 3 +++ moto/core/utils.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/moto/core/responses.py b/moto/core/responses.py index 52be602f6..ae91cdc02 100644 --- a/moto/core/responses.py +++ b/moto/core/responses.py @@ -272,6 +272,9 @@ class BaseResponse(_TemplateEnvironmentMixin): headers['status'] = str(headers['status']) return status, headers, body + if not action: + return 404, headers, '' + raise NotImplementedError( "The {0} action has not been implemented".format(action)) diff --git a/moto/core/utils.py b/moto/core/utils.py index 43f05672e..86e7632b0 100644 --- a/moto/core/utils.py +++ b/moto/core/utils.py @@ -18,6 +18,8 @@ def camelcase_to_underscores(argument): python underscore variable like the_new_attribute''' result = '' prev_char_title = True + if not argument: + return argument for index, char in enumerate(argument): try: next_char_title = argument[index + 1].istitle()