def test_app(self):
     from resource_api.modify_resource import app
     event = {
         "body": "{}"
     }
     handler_response = app.handler(event, None)
     self.assertEqual(handler_response[Constants.response_status_code()], http.HTTPStatus.BAD_REQUEST,
                      'HTTP Status code not 400')
 def test_handler_missing_event(self):
     from resource_api.modify_resource import app
     dynamodb = self.setup_mock_database('eu-west-1',
                                         'testing')
     handler_modify_response = app.handler(None, None)
     self.assertEqual(handler_modify_response[Constants.response_status_code()], http.HTTPStatus.BAD_REQUEST,
                      'HTTP Status code not 400')
     remove_mock_database(dynamodb)
 def test_app_missing_env_region(self):
     del os.environ['REGION']
     from resource_api.modify_resource import app
     app.clear_dynamodb()
     resource = self.generate_mock_resource()
     _event = generate_mock_event(HttpConstants.http_method_put(), resource)
     _handler_response = app.handler(_event, None)
     self.assertEqual(_handler_response[Constants.response_status_code()], http.HTTPStatus.INTERNAL_SERVER_ERROR,
                      'HTTP Status code not 500')
 def test_app_event_invalid_json_in_body(self):
     from resource_api.modify_resource import app
     event = {
         "httpMethod": "PUT",
         "body": "asdf",
         Constants.event_path_parameters(): {Constants.event_path_parameter_identifier(): self.EXISTING_RESOURCE_IDENTIFIER}
     }
     handler_response = app.handler(event, None)
     self.assertEqual(handler_response[Constants.response_status_code()], http.HTTPStatus.BAD_REQUEST,
                      'HTTP Status code not 400')