Coverage for functions \ flipdare \ mailer \ user \ password_reset_email.py: 100%

17 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2026-05-08 12:22 +1000

1#!/usr/bin/env python 

2# Copyright (c) 2026 Flipdare Pty Ltd. All rights reserved. 

3# 

4# This file is part of Flipdare's proprietary software and contains 

5# confidential and copyrighted material. Unauthorised copying, 

6# modification, distribution, or use of this file is strictly 

7# prohibited without prior written permission from Flipdare Pty Ltd. 

8# 

9# This software includes third-party components licensed under MIT, 

10# BSD, and Apache 2.0 licences. See THIRD_PARTY_NOTICES for details. 

11# 

12 

13 

14from typing import override 

15 

16from flipdare.mailer._jinja_email_template import JinjaEmailTemplate 

17from flipdare.mailer.app_email_params import AppEmailParams 

18from flipdare.mailer.app_email_type import AppEmailType 

19from flipdare.generated.schema.email.body.user.password_reset_email_schema import ( 

20 PasswordResetEmailSchema, 

21) 

22from flipdare.wrapper import UserWrapper 

23 

24__all__ = ["PasswordResetEmail"] 

25 

26 

27class PasswordResetEmail(JinjaEmailTemplate[PasswordResetEmailSchema]): 

28 

29 SCHEMA_CLASS = PasswordResetEmailSchema 

30 

31 def __init__(self, to_user: UserWrapper, reset_code: str) -> None: 

32 data = PasswordResetEmailSchema( 

33 to_name=to_user.model.contact_name, 

34 reset_code=reset_code, 

35 ) 

36 super().__init__( 

37 data=data, 

38 params=AppEmailParams( 

39 email_type=AppEmailType.USR_PASSWORD_RESET, 

40 schema=None, 

41 ), 

42 ) 

43 

44 self._reset_code = reset_code 

45 self._to_name = to_user.model.contact_name 

46 

47 @override 

48 def newline_fields(self) -> list[str]: 

49 return [] # no fields expected to have newlines, but can add if needed in the future