-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switchable OTP verification for email bcc fields (#70)
Co-authored-by: Roman Kysil <[email protected]>
- Loading branch information
Showing
3 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -694,6 +694,73 @@ def test_email_field_used_as_bcc( | |
self.assertNotIn("To: [email protected]", bcc_msg) | ||
self.assertIn("To: [email protected]", bcc_msg) | ||
|
||
# Test send wrong otp | ||
response = self.submit_form( | ||
data={ | ||
"data": [ | ||
{"label": "Message", "value": "just want to say hi"}, | ||
{"label": "Name", "value": "Smith"}, | ||
{ | ||
"field_id": "contact", | ||
"label": "Email", | ||
"value": "[email protected]", | ||
"otp": None, | ||
}, | ||
], | ||
"block_id": "form-id", | ||
}, | ||
) | ||
|
||
self.assertEqual(response.status_code, 400) | ||
|
||
# Test do not verify opt if otp flag `email_otp_verification` is False | ||
self.document.blocks = { | ||
"text-id": {"@type": "text"}, | ||
"form-id": { | ||
"@type": "form", | ||
"default_subject": "block subject", | ||
"default_from": "[email protected]", | ||
"send": False, | ||
"store": True, | ||
"email_otp_verification": False, | ||
"subblocks": [ | ||
{ | ||
"field_id": "contact", | ||
"field_type": "from", | ||
"use_as_bcc": True, | ||
}, | ||
{ | ||
"field_id": "message", | ||
"field_type": "text", | ||
}, | ||
{ | ||
"field_id": "name", | ||
"field_type": "text", | ||
}, | ||
], | ||
}, | ||
} | ||
|
||
transaction.commit() | ||
|
||
response = self.submit_form( | ||
data={ | ||
"data": [ | ||
{"label": "Message", "value": "just want to say hi"}, | ||
{"label": "Name", "value": "Smith"}, | ||
{ | ||
"field_id": "contact", | ||
"label": "Email", | ||
"value": "[email protected]", | ||
"otp": 123, | ||
}, | ||
], | ||
"block_id": "form-id", | ||
}, | ||
) | ||
|
||
self.assertEqual(response.status_code, 200) | ||
|
||
def test_send_attachment( | ||
self, | ||
): | ||
|