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.
Make it easier to verify participants in tests
- Loading branch information
1 parent
a182c5c
commit 2af9e57
Showing
1 changed file
with
14 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 |
---|---|---|
|
@@ -173,14 +173,12 @@ def make_team(self, *a, **kw): | |
_kw['available'] = 0 | ||
|
||
if Participant.from_username(_kw['owner']) is None: | ||
owner = self.make_participant( _kw['owner'] | ||
, claimed_time='now' | ||
, last_paypal_result='' | ||
, email_address=_kw['owner']+'@example.com' | ||
) | ||
TT = self.db.one("SELECT id FROM countries WHERE code='TT'") | ||
owner.store_identity_info(TT, 'nothing-enforced', {'name': 'Owner'}) | ||
owner.set_identity_verification(TT, True) | ||
self.make_participant( _kw['owner'] | ||
, claimed_time='now' | ||
, last_paypal_result='' | ||
, email_address=_kw['owner']+'@example.com' | ||
, verified_in='TT' | ||
) | ||
|
||
team = self.db.one(""" | ||
INSERT INTO teams | ||
|
@@ -218,6 +216,7 @@ def make_participant(self, username, **kw): | |
ExchangeRoute.insert(participant, 'paypal', '[email protected]', kw.pop('last_paypal_result')) | ||
|
||
# Update participant | ||
verified_in = kw.pop('verified_in', []) | ||
if kw: | ||
if kw.get('claimed_time') == 'now': | ||
kw['claimed_time'] = utcnow() | ||
|
@@ -231,6 +230,13 @@ def make_participant(self, username, **kw): | |
RETURNING participants.*::participants | ||
""".format(cols, placeholders), vals+(username,)) | ||
|
||
# Verify identity | ||
countries = [verified_in] if type(verified_in) in (str, unicode) else verified_in | ||
for code in countries: | ||
country = self.db.one("SELECT id FROM countries WHERE code=%s", (code,)) | ||
participant.store_identity_info(country, 'nothing-enforced', {'name': username}) | ||
participant.set_identity_verification(country, True) | ||
|
||
return participant | ||
|
||
|
||
|