| 59 | |
| 60 | |
| 61 | class FakeEmailService(BaseEmailService): |
| 62 | def __init__(self, codes): |
| 63 | super().__init__(EmailServiceType.TEMPMAIL) |
| 64 | self.codes = list(codes) |
| 65 | self.otp_requests = [] |
| 66 | |
| 67 | def create_email(self, config=None): |
| 68 | return { |
| 69 | "email": "tester@example.com", |
| 70 | "service_id": "mailbox-1", |
| 71 | } |
| 72 | |
| 73 | def get_verification_code(self, email, email_id=None, timeout=120, pattern=r"(?<!\d)(\d{6})(?!\d)", otp_sent_at=None): |
| 74 | self.otp_requests.append({ |
| 75 | "email": email, |
| 76 | "email_id": email_id, |
| 77 | "otp_sent_at": otp_sent_at, |
| 78 | }) |
| 79 | if not self.codes: |
| 80 | raise AssertionError("no verification code queued") |
| 81 | return self.codes.pop(0) |
| 82 | |
| 83 | def list_emails(self, **kwargs): |
| 84 | return [] |
| 85 | |
| 86 | def delete_email(self, email_id): |
| 87 | return True |
| 88 | |
| 89 | def check_health(self): |
| 90 | return True |
| 91 | |
| 92 | |
| 93 | class FakeOAuthManager: |
no outgoing calls