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.
Finish test suite for package linking via email
- Loading branch information
1 parent
9df2002
commit 1f519df
Showing
2 changed files
with
19 additions
and
11 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 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 |
---|---|---|
|
@@ -168,10 +168,18 @@ def test_verify_email_expired_nonce(self): | |
def test_finish_email_verification(self): | ||
self.hit_email_spt('add-email', '[email protected]') | ||
nonce = self.alice.get_email('[email protected]').nonce | ||
self.finish_email_verification('[email protected]', nonce) | ||
expected = '[email protected]' | ||
actual = P('alice').email_address | ||
assert expected == actual | ||
assert self.finish_email_verification('[email protected]', nonce).code == 200 | ||
assert P('alice').email_address == '[email protected]' | ||
|
||
def test_empty_email_results_in_missing(self): | ||
for empty in ('', ' '): | ||
result = self.alice.finish_email_verification(empty, 'foobar') | ||
assert result == _email.VERIFICATION_MISSING | ||
|
||
def test_empty_nonce_results_in_missing(self): | ||
for empty in ('', ' '): | ||
result = self.alice.finish_email_verification('foobar', empty) | ||
assert result == _email.VERIFICATION_MISSING | ||
|
||
def test_email_verification_is_backwards_compatible(self): | ||
"""Test email verification still works with unencoded email in verification link. | ||
|
@@ -706,29 +714,29 @@ def test_preverify_preverifies(self): | |
|
||
|
||
def test_unverified_address_and_no_packages_succeeds(self): | ||
assert self.check() | ||
self.check() | ||
|
||
def test_unverified_address_and_one_package_succeeds(self): | ||
assert self.check('foo') | ||
self.check('foo') | ||
|
||
def test_unverified_address_and_multiple_packages_succeeds(self): | ||
assert self.check('foo', 'bar') | ||
self.check('foo', 'bar') | ||
|
||
def test_verified_address_and_no_packages_is_a_no_go(self): | ||
self.preverify() | ||
raises(EmailAlreadyVerified, self.check) | ||
|
||
def test_verified_address_and_one_package_succeeds(self): | ||
self.preverify() | ||
assert self.check('foo') | ||
self.check('foo') | ||
|
||
def test_verified_address_and_multiple_packages_succeeds(self): | ||
self.preverify() | ||
assert self.check('foo', 'bar') | ||
self.check('foo', 'bar') | ||
|
||
|
||
def test_while_we_are_at_it_that_packages_have_unique_teams_that_survive_comparison(self): | ||
self.test_handles_verified_address_and_multiple_packages() | ||
self.test_verified_address_and_multiple_packages_succeeds() | ||
|
||
foo = Package.from_names('npm', 'foo') | ||
bar = Package.from_names('npm', 'bar') | ||
|