|
|
|
@ -47,7 +47,7 @@ def test_base_child_prepare_form_url():
@@ -47,7 +47,7 @@ def test_base_child_prepare_form_url():
|
|
|
|
|
parent = DummyResource() |
|
|
|
|
request = DummyRequest() |
|
|
|
|
resource = BaseChildResource(request, 'a name', parent) |
|
|
|
|
form = resource._prepare_form(RegistrationSchema, url='/foo') |
|
|
|
|
form = resource._prepare_form(RegistrationSchema, action='/foo') |
|
|
|
|
assert form.action == '/foo' |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -63,3 +63,20 @@ def test_base_child_prepare_form_settings():
@@ -63,3 +63,20 @@ def test_base_child_prepare_form_settings():
|
|
|
|
|
assert len(form.buttons) == 2 |
|
|
|
|
assert isinstance(form.buttons[0], deform.Button) |
|
|
|
|
assert isinstance(form.buttons[1], deform.Button) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_base_child_prepare_form_prefill(): |
|
|
|
|
from ordr.resources.helpers import BaseChildResource |
|
|
|
|
from ordr.schemas.account import RegistrationSchema |
|
|
|
|
parent = DummyResource() |
|
|
|
|
request = DummyRequest() |
|
|
|
|
resource = BaseChildResource(request, 'a name', parent) |
|
|
|
|
prefill = { |
|
|
|
|
'first_name': 'John', |
|
|
|
|
'last_name': 'Doe', |
|
|
|
|
'email': 'johndoe@example.com' |
|
|
|
|
} |
|
|
|
|
form = resource._prepare_form(RegistrationSchema, prefill=prefill) |
|
|
|
|
assert form['first_name'].cstruct == 'John' |
|
|
|
|
assert form['last_name'].cstruct == 'Doe' |
|
|
|
|
assert form['email'].cstruct == 'johndoe@example.com' |
|
|
|
|