Exemplo n.º 1
0
def test_batching():
    """Base batching test. The Batcher is tested in ``dolmen.batch``.
    We simply need to make sure we have plugged it correctly and that
    it gets the right values out of the form.
    """
    request = TestRequest()
    form = TableForm(content, request)

    # The table can generate a batch out-of-the-box.
    # However, that capability has to be activated.
    form = TableForm(content, request)
    form.createBatch = True

    # @ testing conf.
    # To be able to compute the URL, we need to define a publication root
    directlyProvides(form, IPublicationRoot)

    # Now, we can test it:
    form.batchSize = 1
    form.update()
    form.updateForm()
    assert form.batcher.size == 1
    assert form.batcher.url == 'http://localhost'