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.
Return only valid team members from lookup.json
- Loading branch information
1 parent
505c14f
commit 51d9739
Showing
2 changed files
with
17 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,11 @@ def lookup(self, q): | |
data = json.loads(response.body) | ||
return [d['id'] for d in data] | ||
|
||
|
||
def make_alice(self, **kw): | ||
kw.update(claimed_time='now', email_address='[email protected]', verified_in='TT') | ||
return self.make_participant("alice", **kw) | ||
|
||
def test_get_without_query_returns_400(self): | ||
response = self.client.GxT('/lookup.json') | ||
assert response.code == 400 | ||
|
@@ -19,19 +24,19 @@ def test_looking_up_non_existent_user_finds_nothing(self): | |
assert self.lookup('alice') == [-1] | ||
|
||
def test_looking_up_non_searchable_user_with_an_exact_match_finds_them(self): | ||
alice = self.make_participant("alice", claimed_time='now', is_searchable=False) | ||
alice = self.make_alice(is_searchable=False) | ||
assert self.lookup('alice') == [alice.id] | ||
|
||
def test_looking_up_non_searchable_user_without_exact_match_finds_nothing(self): | ||
self.make_participant("alice", claimed_time='now', is_searchable=False) | ||
self.make_alice(is_searchable=False) | ||
assert self.lookup('alic') == [-1] | ||
|
||
def test_looking_up_searchable_user_with_an_exact_match_finds_them(self): | ||
alice = self.make_participant("alice", claimed_time='now') | ||
alice = self.make_alice() | ||
assert self.lookup('alice') == [alice.id] | ||
|
||
def test_looking_up_searchable_user_without_an_exact_match_finds_them(self): | ||
alice = self.make_participant("alice", claimed_time='now') | ||
alice = self.make_alice() | ||
assert self.lookup('alic') == [alice.id, -1] | ||
|
||
|
||
|
@@ -42,16 +47,16 @@ def test_looking_up_suspicious_user_finds_nothing(self): | |
, email_address='[email protected]' | ||
, is_suspicious=True | ||
) | ||
assert self.lookup('alice') == [] | ||
assert self.lookup('alice') == [-1] | ||
|
||
def test_looking_up_unverified_user_finds_nothing(self): | ||
self.make_participant("alice", claimed_time='now', email_address='[email protected]') | ||
assert self.lookup('alice') == [] | ||
assert self.lookup('alice') == [-1] | ||
|
||
def test_looking_up_user_with_no_email_finds_nothing(self): | ||
self.make_participant("alice", claimed_time='now') # can't verify w/o email! | ||
assert self.lookup('alice') == [] | ||
assert self.lookup('alice') == [-1] | ||
|
||
def test_looking_up_unclaimed_user_finds_nothing(self): | ||
self.make_participant("alice", verified_in='TT', email_address='[email protected]') | ||
assert self.lookup('alice') == [] | ||
assert self.lookup('alice') == [-1] |
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