summaryrefslogtreecommitdiff
path: root/service/test
diff options
context:
space:
mode:
authorDenis Costa <deniscostadsc@gmail.com>2017-04-13 16:39:30 -0300
committerTulio Casagrande <tcasagra@thoughtworks.com>2017-04-13 17:32:13 -0300
commitdd189164ef0b39132daafcbe5d163bc259ccec8e (patch)
tree57776da477e91f938ac5fa7b132e94df6ae0b3fb /service/test
parent1fcb0c8fb399647bf86ef1b7c6771b3a29f67aa9 (diff)
[#927] Add recovery code mail template
with @tuliocasagrande
Diffstat (limited to 'service/test')
-rw-r--r--service/test/functional/features/steps/mail_list.py6
-rw-r--r--service/test/functional/features/steps/mail_view.py6
-rw-r--r--service/test/unit/test_account_recovery.py24
3 files changed, 29 insertions, 7 deletions
diff --git a/service/test/functional/features/steps/mail_list.py b/service/test/functional/features/steps/mail_list.py
index 2953c1af..21694153 100644
--- a/service/test/functional/features/steps/mail_list.py
+++ b/service/test/functional/features/steps/mail_list.py
@@ -138,9 +138,3 @@ def impl(context):
@then('I should not see any email')
def impl(context):
_wait_for_mail_list_to_be_empty(context)
-
-
-@then(u'I see the mail has the recovery code')
-def step_impl(context):
- expected_body = 'Your code'
- context.execute_steps(u"Then I see that the body has '%s'" % expected_body)
diff --git a/service/test/functional/features/steps/mail_view.py b/service/test/functional/features/steps/mail_view.py
index d10f86e7..9b49e6e5 100644
--- a/service/test/functional/features/steps/mail_view.py
+++ b/service/test/functional/features/steps/mail_view.py
@@ -109,3 +109,9 @@ def impl(context):
assert cc is not None
assert bcc is not None
+
+
+@then(u'I see the mail has the recovery code')
+def step_impl(context):
+ expected_body = 'This code is they only way to recover access to your account in case you lose your password.'
+ context.execute_steps(u"Then I see that the body has '%s'" % expected_body)
diff --git a/service/test/unit/test_account_recovery.py b/service/test/unit/test_account_recovery.py
index 08298419..8d52676e 100644
--- a/service/test/unit/test_account_recovery.py
+++ b/service/test/unit/test_account_recovery.py
@@ -24,6 +24,28 @@ from mockito import when, any as ANY
from pixelated.account_recovery import AccountRecovery
+RECOVERY_CODE_EMAIL = '''Hello,
+
+You are receiving this email because you registered at a Pixelated provider, on test.com.
+In case you ever forget your password, you can access this link test.com/account-recovery and put the following recovery code:
+
+4645a2f8997e5d0d
+
+This code is they only way to recover access to your account in case you lose your password.
+Be careful and keep it safe!!!
+
+Why is this so important?
+
+Pixelated is an email client that respects your privacy and uses PGP Encryption to do so.
+Your password also gives you access to your keys, so if you forget it you will lose access to your account and the ability to decrypt your messages.
+We understand that forgetting passwords is a common thing, so we developed a more secure way to recover access to your account, therefore, a little bit more annoying ;)
+This code is half of a big code to recover your account, the other half is with the account administrator. In case you forget your password, use this code and your administrator code to recover access to your account. It\'s like those locks with two keys :)
+You will only succeed if you have both codes, so, never hurts to ask again: SAVE THIS CODE!
+
+
+PS: If you didn\'t create an account at test.com, please ignore this email.
+'''
+
class AccountRecoveryTest(unittest.TestCase):
def setUp(self):
@@ -53,7 +75,7 @@ class AccountRecoveryTest(unittest.TestCase):
@defer.inlineCallbacks
def test_send_recovery_code_by_email(self):
sender = 'team@{}'.format(self.domain)
- msg = MIMEText('Your code %s' % self.generated_code)
+ msg = MIMEText(RECOVERY_CODE_EMAIL)
msg['Subject'] = 'Recovery Code'
msg['From'] = sender
msg['To'] = self.backup_email