Coverage for functions \ flipdare \ mailer \ user \ signup_code_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 

15from flipdare.mailer._jinja_email_template import JinjaEmailTemplate 

16from flipdare.mailer.app_email_params import AppEmailParams 

17from flipdare.mailer.app_email_type import AppEmailType 

18from flipdare.generated.schema.email.body.user.signup_code_email_schema import ( 

19 SignupCodeEmailSchema, 

20) 

21from flipdare.wrapper import UserWrapper 

22 

23__all__ = ["SignupCodeEmail"] 

24 

25 

26class SignupCodeEmail(JinjaEmailTemplate[SignupCodeEmailSchema]): 

27 

28 SCHEMA_CLASS = SignupCodeEmailSchema 

29 

30 def __init__(self, to_user: UserWrapper, signup_code: str) -> None: 

31 data = SignupCodeEmailSchema( 

32 to_name=to_user.model.contact_name, 

33 signup_code=signup_code, 

34 ) 

35 super().__init__( 

36 data=data, 

37 params=AppEmailParams( 

38 email_type=AppEmailType.USR_SIGNUP_CODE, 

39 schema=None, 

40 ), 

41 ) 

42 

43 self._signup_code = signup_code 

44 self._to_name = to_user.model.contact_name 

45 

46 @override 

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

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