prepopulate remaining user data on request form
This commit is contained in:
parent
9fe7d877ba
commit
93bf0dcb8a
@ -63,6 +63,11 @@ class JEDIRequestFlow(object):
|
||||
"fname_request": user.first_name,
|
||||
"lname_request": user.last_name,
|
||||
"email_request": user.email,
|
||||
"phone_number": user.phone_number,
|
||||
"service_branch": user.service_branch,
|
||||
"designation": user.designation,
|
||||
"citizenship": user.citizenship,
|
||||
"date_latest_training": user.date_latest_training,
|
||||
}
|
||||
|
||||
@property
|
||||
|
@ -1,3 +1,4 @@
|
||||
import datetime
|
||||
import re
|
||||
from tests.factories import (
|
||||
RequestFactory,
|
||||
@ -93,9 +94,18 @@ def test_creator_info_is_autopopulated_for_existing_request(
|
||||
|
||||
response = client.get("/requests/new/2/{}".format(request.id))
|
||||
body = response.data.decode()
|
||||
assert "initial-value='{}'".format(user.first_name) in body
|
||||
assert "initial-value='{}'".format(user.last_name) in body
|
||||
assert "initial-value='{}'".format(user.email) in body
|
||||
prepopulated_values = [
|
||||
"first_name",
|
||||
"last_name",
|
||||
"email",
|
||||
"phone_number",
|
||||
"date_latest_training",
|
||||
]
|
||||
for attr in prepopulated_values:
|
||||
value = getattr(user, attr)
|
||||
if isinstance(value, datetime.date):
|
||||
value = value.strftime("%m/%d/%Y")
|
||||
assert "initial-value='{}'".format(value) in body
|
||||
|
||||
|
||||
def test_creator_info_is_autopopulated_for_new_request(
|
||||
|
Loading…
x
Reference in New Issue
Block a user