update request autopopulate to rely on creator

This commit is contained in:
dandds 2018-08-09 09:32:17 -04:00
parent 07ce940650
commit efee79a566
2 changed files with 6 additions and 6 deletions

View File

@ -63,11 +63,11 @@ class JEDIRequestFlow(object):
# maps user data to fields in OrgForm; this should be moved into the
# request initialization process when we have a request schema
def map_current_user(self):
if self.current_user.id == self.request.creator:
if self.request:
return {
"fname_request": self.current_user.first_name,
"lname_request": self.current_user.last_name,
"email_request": self.current_user.email
"fname_request": self.request.creator.first_name,
"lname_request": self.request.creator.last_name,
"email_request": self.request.creator.email
}
else:
return {}

View File

@ -71,7 +71,7 @@ def test_nonexistent_request(client, user_session):
def test_creator_info_is_autopopulated(monkeypatch, client, user_session):
user = UserFactory.create()
user_session(user)
request = RequestFactory.create(creator=user.id, body={"information_about_you": {}})
request = RequestFactory.create(creator=user, body={"information_about_you": {}})
response = client.get("/requests/new/2/{}".format(request.id))
body = response.data.decode()
@ -84,7 +84,7 @@ def test_non_creator_info_is_not_autopopulated(monkeypatch, client, user_session
user = UserFactory.create()
creator = UserFactory.create()
user_session(user)
request = RequestFactory.create(creator=creator.id, body={"information_about_you": {}})
request = RequestFactory.create(creator=creator, body={"information_about_you": {}})
response = client.get("/requests/new/2/{}".format(request.id))
body = response.data.decode()