How to use get_passthrough_behavior method in localstack

Best Python code snippet using localstack_python

integration.py

Source:integration.py Github

copy

Full Screen

...42 passthrough_behavior: PassthroughBehavior43 class UnsupportedMediaType(Exception):44 pass45 def __init__(self, passthrough_behaviour: str):46 self.passthrough_behavior = self.get_passthrough_behavior(passthrough_behaviour)47 def check_passthrough_behavior(self, request_template):48 """49 Specifies how the method request body of an unmapped content type will be passed through50 the integration request to the back end without transformation.51 A content type is unmapped if no mapping template is defined in the integration or the52 content type does not match any of the mapped content types, as specified in requestTemplates53 """54 if not request_template and self.passthrough_behavior in {55 PassthroughBehavior.NEVER,56 PassthroughBehavior.WHEN_NO_TEMPLATES,57 }:58 raise MappingTemplates.UnsupportedMediaType()59 @staticmethod60 def get_passthrough_behavior(passthrough_behaviour: str):61 return getattr(PassthroughBehavior, passthrough_behaviour, None)62class BackendIntegration(ABC):63 """Abstract base class representing a backend integration"""64 def __init__(self):65 self.request_templates = RequestTemplates()66 self.response_templates = ResponseTemplates()67 @abstractmethod68 def invoke(self, invocation_context: ApiInvocationContext):69 pass70 @classmethod71 def _create_response(cls, status_code, headers, data=""):72 response = Response()73 response.status_code = status_code74 response.headers = headers...

Full Screen

Full Screen

templates.py

Source:templates.py Github

copy

Full Screen

...28 passthrough_behavior: PassthroughBehavior29 class UnsupportedMediaType(Exception):30 pass31 def __init__(self, passthrough_behaviour: str):32 self.passthrough_behavior = self.get_passthrough_behavior(passthrough_behaviour)33 def check_passthrough_behavior(self, request_template):34 """35 Specifies how the method request body of an unmapped content type will be passed through36 the integration request to the back end without transformation.37 A content type is unmapped if no mapping template is defined in the integration or the38 content type does not match any of the mapped content types, as specified in requestTemplates39 """40 if not request_template and self.passthrough_behavior in {41 PassthroughBehavior.NEVER,42 PassthroughBehavior.WHEN_NO_TEMPLATES,43 }:44 raise MappingTemplates.UnsupportedMediaType()45 @staticmethod46 def get_passthrough_behavior(passthrough_behaviour: str):47 return getattr(PassthroughBehavior, passthrough_behaviour, None)48class VelocityUtilApiGateway(VelocityUtil):49 """50 Simple class to mimic the behavior of variable '$util' in AWS API Gateway integration51 velocity templates.52 See: http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html53 """54 def base64Encode(self, s):55 if not isinstance(s, str):56 s = json.dumps(s)57 encoded_str = s.encode(config.DEFAULT_ENCODING)58 encoded_b64_str = base64.b64encode(encoded_str)59 return encoded_b64_str.decode(config.DEFAULT_ENCODING)60 def base64Decode(self, s):...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful