CPI Ordering System (the old version)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
 

28 lines
865 B

''' Test package for ordr.schemas '''
from pyramid.testing import DummyRequest, DummyResource
def test_csrf_schema_form_with_custom_url():
''' test for creation with custom url '''
from ordr.schemas import CSRFSchema
request = DummyRequest()
form = CSRFSchema.as_form(request, action='/Nudge/Nudge')
assert form.action == '/Nudge/Nudge'
assert form.buttons == []
def test_csrf_schema_form_with_automatic_url():
''' test for creation with custom url '''
from ordr.schemas import CSRFSchema
root = DummyResource()
context = DummyResource('Crunchy', root)
request = DummyRequest(context=context, view_name='Frog')
form = CSRFSchema.as_form(request, buttons=['submit'])
assert 'http://example.com/Crunchy/Frog' == form.action
assert len(form.buttons) == 1
assert form.buttons[0].type == 'submit'