Skip to content

Commit

Permalink
Raise ValueError in get_claim_url if no record on a given project.
Browse files Browse the repository at this point in the history
    - fix test_modles.TestUnregisteredUser
    - revert previous changes
  • Loading branch information
cslzchen committed Jul 20, 2016
1 parent 617d2eb commit 6be7705
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 3 additions & 5 deletions framework/auth/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,17 +713,15 @@ def verify_claim_token(self, token, project_id):
def get_claim_url(self, project_id, external=False):
"""
Return the URL that an unclaimed user should use to claim their account.
Return `None` if there is no unclaimed_record for the given project ID.
Raise `ValueError` if there is no unclaimed_record for the given project ID.
:param project_id: the project ID for the unclaimed record
:param external:
:rtype: string
:returns: the claim url
:raises: ValueError if there is no record for the given project.
"""
try:
unclaimed_record = self.get_unclaimed_record(project_id)
except ValueError:
return None
unclaimed_record = self.get_unclaimed_record(project_id)
uid = self._primary_key
base_url = settings.DOMAIN if external else '/'
token = unclaimed_record['token']
Expand Down
1 change: 1 addition & 0 deletions tests/models/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ def test_merge(self, mock_get_mailchimp_api):
'username',
'mailing_lists',
'verification_key',
'verification_key_v2',
'_affiliated_institutions',
'contributor_added_email_records',
'requested_deactivation'
Expand Down

0 comments on commit 6be7705

Please sign in to comment.