This repository has been archived by the owner on Feb 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start working on limiting verifications in UI
- Loading branch information
1 parent
13009bc
commit 006b59b
Showing
6 changed files
with
81 additions
and
56 deletions.
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#emails #content { | ||
|
||
} |
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 |
---|---|---|
|
@@ -7,9 +7,13 @@ | |
|
||
class Tests(BrowserHarness, QueuedEmailHarness): | ||
|
||
def test_can_verify_email(self): | ||
def setUp(self): | ||
BrowserHarness.setUp(self) | ||
QueuedEmailHarness.setUp(self) | ||
self.make_participant('alice', claimed_time='now') | ||
self.sign_in('alice') | ||
|
||
def start_verification(self, email_address): | ||
self.visit('/~alice/emails/') | ||
self.css('#content input').fill('[email protected]') | ||
self.css('#content button').click() | ||
|
@@ -20,6 +24,36 @@ def test_can_verify_email(self): | |
, verification_email['body_text'] | ||
, re.DOTALL | re.MULTILINE | ||
).groups()[0] | ||
return verification_link | ||
|
||
def attempt_verification(self, email_address): | ||
verification_link = self.start_verification(email_address) | ||
self.visit(verification_link) | ||
assert self.css('#content h1').text == 'Success!' | ||
return self.css('#content h1').text | ||
|
||
|
||
def test_can_verify_email_address(self): | ||
assert self.attempt_verification('[email protected]') == 'Success!' | ||
|
||
def test_can_resend_when_pending(self): | ||
self.start_verification('[email protected]') | ||
assert self.attempt_verification('[email protected]') == 'Success!' | ||
|
||
def test_can_reverify_when_already_verified(self): | ||
raise NotImplementedError | ||
|
||
|
||
def test_cannot_start_a_second_verification_while_one_open(self): | ||
raise NotImplementedError | ||
|
||
|
||
def test_can_start_a_second_verification_when_first_completed(self): | ||
raise NotImplementedError | ||
|
||
|
||
def test_verification_constraint_survives_remove_and_readd(self): | ||
raise NotImplementedError | ||
|
||
|
||
def test_verification_constraint_survives_close_and_reopen(self): | ||
raise NotImplementedError |
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 |
---|---|---|
|
@@ -7,6 +7,7 @@ banner = '~' + participant.username | |
title = _("Emails") | ||
|
||
emails = participant.get_emails() | ||
page_id = 'emails' | ||
|
||
[-----------------------------------------------------------------------------] text/html | ||
{% extends "templates/profile.html" %} | ||
|
@@ -17,26 +18,35 @@ emails = participant.get_emails() | |
{% endblock %} | ||
|
||
{% block content %} | ||
<div id="emails" class="emails"> | ||
<ul> | ||
{% for email in emails %} | ||
{% set is_primary = email.address == participant.email_address %} | ||
<li class="{{ 'primary' if is_primary }} {{ 'verified' if email.verified }}" | ||
data-email="{{ email.address }}"> | ||
{{ email.address }} | ||
<span class="label-primary">{{ _("Primary") }}</span> | ||
<span class="label-unverified">{{ _("Unverified") }}</span> | ||
<button class="remove">{{ _("Remove") }}</button> | ||
<button class="resend">{{ _("Resend") }}</button> | ||
<button class="set-primary">{{ _("Set as primary") }}</button> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
<form class="add-email"> | ||
<input class="add-email" name="email" type="email" placeholder="[email protected]" /> | ||
<button type="submit">{{ _("Add email address") }}</button> | ||
</form> | ||
</div> | ||
<table class="emails listing"> | ||
{% for i, email in enumerate(emails) %} | ||
{% set is_primary = email.address == participant.email_address %} | ||
<tr> | ||
<td class="item" data-email="{{ email.address }}"> | ||
<span class="icon"></span> | ||
<div class="listing-details"> | ||
<span class="listing-name">{{ email.address }}</span> | ||
<span class="i">{{ i }}</span> · | ||
{% if email.verified %} | ||
{% if is_primary %} | ||
<span class="label-primary">{{ _("Primary") }}</span> | ||
{% else %} | ||
<button class="set-primary">{{ _("Set as primary") }}</button> | ||
{% endif %} · | ||
<button class="remove">{{ _("Remove") }}</button> | ||
{% else %} | ||
<span class="label-unverified">{{ _("Unverified") }}</span> · | ||
<button class="resend">{{ _("Resend") }}</button> | ||
{% endif %} | ||
</div> | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</table> | ||
<form class="add-email"> | ||
<input class="add-email" name="email" type="email" placeholder="[email protected]" /> | ||
<button type="submit">{{ _("Add email address") }}</button> | ||
</form> | ||
|
||
<h2 id="notifications">{{ _("Notifications") }}</h2> | ||
<div class="email-notifications"> | ||
|