Coverage for src/integrify/lsim/single/handlers.py: 100%
22 statements
« prev ^ index » next coverage.py v7.9.2, created at 2025-09-01 02:22 +0000
« prev ^ index » next coverage.py v7.9.2, created at 2025-09-01 02:22 +0000
1from integrify.api import APIPayloadHandler
2from integrify.lsim.single.schemas.request import (
3 CheckBalanceRequestSchema,
4 GetReportGetRequestSchema,
5 GetReportPostRequestSchema,
6 SendSMSGetRequestSchema,
7 SendSMSPostRequestSchema,
8)
9from integrify.lsim.single.schemas.response import (
10 BaseGetResponseSchema,
11 BasePostResponseSchema,
12 ReportGetResponseSchema,
13 ReportPostResponseSchema,
14)
17class SendSMSGetPayloadHandler(APIPayloadHandler):
18 def __init__(self):
19 super().__init__(SendSMSGetRequestSchema, BaseGetResponseSchema)
22class SendSMSPostPayloadHandler(APIPayloadHandler):
23 def __init__(self):
24 super().__init__(SendSMSPostRequestSchema, BasePostResponseSchema)
27class CheckBalancePayloadHandler(APIPayloadHandler):
28 def __init__(self):
29 super().__init__(CheckBalanceRequestSchema, BaseGetResponseSchema)
32class GetReportGetPayloadHandler(APIPayloadHandler):
33 def __init__(self):
34 super().__init__(GetReportGetRequestSchema, ReportGetResponseSchema)
36 def handle_response(self, resp):
37 data = resp.content.decode()
38 resp._content = f'{{"error_code": {data}}}'.encode() # pylint: disable=protected-access
39 return super().handle_response(resp)
42class GetReportPostPayloadHandler(APIPayloadHandler):
43 def __init__(self):
44 super().__init__(GetReportPostRequestSchema, ReportPostResponseSchema)