def test_unregistered_contributor_detail_show_up_as_name_associated_with_preprint( self, app, user, preprint_published): preprint_published.add_unregistered_contributor('Rheisen Dennis', '*****@*****.**', auth=Auth(user), save=True) unregistered_contributor = preprint_published.contributors[1] url = '/{}preprints/{}/contributors/{}/'.format( API_BASE, preprint_published._id, unregistered_contributor._id) res = app.get(url, auth=user.auth, expect_errors=True) assert res.status_code == 200 assert res.json['data']['embeds']['users']['data']['attributes'][ 'full_name'] == 'Rheisen Dennis' assert res.json['data']['attributes'].get( 'unregistered_contributor') == 'Rheisen Dennis' preprint_two = PreprintFactory(creator=user, is_public=True) preprint_two.add_unregistered_contributor('Nesiehr Sinned', '*****@*****.**', auth=Auth(user), save=True) url = '/{}preprints/{}/contributors/{}/'.format( API_BASE, preprint_two._id, unregistered_contributor._id) res = app.get(url, auth=user.auth, expect_errors=True) assert res.status_code == 200 assert res.json['data']['embeds']['users']['data']['attributes'][ 'full_name'] == 'Rheisen Dennis' assert res.json['data']['attributes'].get( 'unregistered_contributor') == 'Nesiehr Sinned'
def test_unregistered_contributor_detail_show_up_as_name_associated_with_preprint( self, app, user, preprint_published): preprint_published.add_unregistered_contributor( 'Rheisen Dennis', '*****@*****.**', auth=Auth(user), save=True) unregistered_contributor = preprint_published.contributors[1] url = '/{}preprints/{}/contributors/{}/'.format( API_BASE, preprint_published._id, unregistered_contributor._id) res = app.get(url, auth=user.auth, expect_errors=True) assert res.status_code == 200 assert res.json['data']['embeds']['users']['data']['attributes']['full_name'] == 'Rheisen Dennis' assert res.json['data']['attributes'].get( 'unregistered_contributor') == 'Rheisen Dennis' preprint_two = PreprintFactory(creator=user, is_public=True) preprint_two.add_unregistered_contributor( 'Nesiehr Sinned', '*****@*****.**', auth=Auth(user), save=True) url = '/{}preprints/{}/contributors/{}/'.format( API_BASE, preprint_two._id, unregistered_contributor._id) res = app.get(url, auth=user.auth, expect_errors=True) assert res.status_code == 200 assert res.json['data']['embeds']['users']['data']['attributes']['full_name'] == 'Rheisen Dennis' assert res.json['data']['attributes'].get( 'unregistered_contributor') == 'Nesiehr Sinned'
def test_claim_user_registered_preprint_with_correct_password(self): preprint = PreprintFactory(creator=self.referrer) name, email = fake.name(), fake_email() unreg_user = preprint.add_unregistered_contributor( fullname=name, email=email, auth=Auth(user=self.referrer) ) reg_user = AuthUserFactory() # NOTE: AuthUserFactory sets password as 'queenfan86' url = unreg_user.get_claim_url(preprint._id) # Follow to password re-enter page res = self.app.get(url, auth=reg_user.auth).follow(auth=reg_user.auth) # verify that the "Claim Account" form is returned assert_in('Claim Contributor', res.body) form = res.forms['claimContributorForm'] form['password'] = '******' res = form.submit(auth=reg_user.auth) preprint.reload() unreg_user.reload() # user is now a contributor to the project assert_in(reg_user, preprint.contributors) # the unregistered user (unreg_user) is removed as a contributor, and their assert_not_in(unreg_user, preprint.contributors) # unclaimed record for the project has been deleted assert_not_in(preprint, unreg_user.unclaimed_records)