|
1 | 1 | import random |
2 | | -import requests |
3 | 2 | import re |
4 | 3 | import string |
5 | 4 | from BaseObjects import BaseOutboundFundsCommunityPage |
6 | 5 | from cumulusci.robotframework.utils import selenium_retry |
7 | 6 | from OutboundFundsCommunity import outboundfundscommunity_lex_locators |
8 | 7 |
|
9 | 8 |
|
10 | | -endpoint = "https://api.testmail.app/api/json?apikey=cc5a1174-6d74-46d4-9ee9-409cc1da75d1&namespace=gms" |
11 | | - |
12 | | - |
13 | 9 | @selenium_retry |
14 | 10 | class Email(BaseOutboundFundsCommunityPage): |
15 | | - def get_reset_password_url(self, tag): |
16 | | - """Retrieves reset password URL from email sent to user""" |
17 | | - params = { |
18 | | - "tag": tag, |
19 | | - } |
20 | | - email_data = requests.get(endpoint, params=params, timeout=30) |
21 | | - email_json = email_data.json() |
22 | | - email_text = email_json["emails"][0]["text"] |
23 | | - reset_password_url = re.search(r"(?P<url>https?://[^\s]+)", email_text).group( |
24 | | - "url" |
25 | | - ) |
26 | | - return reset_password_url |
27 | | - |
28 | | - def verify_submit_application_email_received(self, tag): |
29 | | - """"Verifies if user received the submit application email""" |
30 | | - params = { |
31 | | - "tag": tag, |
32 | | - } |
33 | | - email_data = requests.get(endpoint, params=params, timeout=60) |
34 | | - email_json = email_data.json() |
35 | | - email_subject = email_json["emails"][0]["text"] |
36 | | - substring = "Weve received your application and will be reviewing it soon" |
37 | | - if substring in email_subject: |
38 | | - pass |
39 | | - else: |
40 | | - raise Exception("Email not found") |
41 | | - |
42 | 11 | def get_tag(self, email): |
43 | 12 | split = re.split("[.@]", email) |
44 | 13 | tag = split[1] |
|
0 commit comments