Example #1
0
def test_create_form_creates_form_with_GroupSchema(GroupSchema, Form):
    test_schema = mock.Mock()
    GroupSchema.return_value = mock.Mock(bind=mock.Mock(return_value=test_schema))

    views.create_form(request=_mock_request())

    assert Form.call_args[0][0] == test_schema
Example #2
0
def test_create_form_creates_form_with_GroupSchema(GroupSchema, Form):
    test_schema = mock.Mock()
    GroupSchema.return_value = mock.Mock(
        bind=mock.Mock(return_value=test_schema))

    views.create_form(request=_mock_request())

    assert Form.call_args[0][0] == test_schema
Example #3
0
def test_create_form_creates_form_with_GroupSchema(GroupSchema, Form):
    test_schema = mock.Mock()
    GroupSchema.return_value = mock.Mock(
        bind=mock.Mock(return_value=test_schema))

    views.create_form(request=_mock_request())

    Form.assert_called_once_with(test_schema)
Example #4
0
def test_create_form_creates_form_with_GroupSchema(GroupSchema, Form):
    test_schema = mock.Mock()
    GroupSchema.return_value = mock.Mock(
        bind=mock.Mock(return_value=test_schema))

    views.create_form(request=_mock_request())

    Form.assert_called_once_with(test_schema)
Example #5
0
def test_create_form_returns_form(Form):
    test_form = mock.Mock()
    Form.return_value = test_form

    result = views.create_form(request=_mock_request())

    assert result["form"] == test_form.render.return_value
Example #6
0
def test_create_form_returns_empty_form_data(Form):
    test_form = mock.Mock()
    Form.return_value = test_form

    template_data = views.create_form(request=_mock_request())

    assert template_data["data"] == {}
Example #7
0
def test_create_form_returns_empty_form_data(Form):
    test_form = mock.Mock()
    Form.return_value = test_form

    template_data = views.create_form(request=_mock_request())

    assert template_data["data"] == {}
Example #8
0
def test_create_form_404s_if_groups_feature_is_off():
    with pytest.raises(httpexceptions.HTTPNotFound):
        views.create_form(_mock_request(feature=lambda feature: False))
Example #9
0
def test_create_form_404s_if_groups_feature_is_off():
    with pytest.raises(httpexceptions.HTTPNotFound):
        views.create_form(_mock_request(feature=lambda feature: False))