def test_todict_config(config):
    from rebecca.todict import todict
    import dummy
    config.scan(dummy)
    
    request = testing.DummyRequest()
    result = todict(request, dummy.Dummy(), name="testing")
    
    assert result == dict(value="testing")
def test_named_todict(config):
    from rebecca.todict import todict
    from dummy import Dummy, to_dict_dummy_another

    config.set_todict(Dummy, to_dict_dummy_another, name="another")

    dummy = Dummy()
    request = testing.DummyRequest()
    result = todict(request, dummy, name="another")
    
    assert result == dict(value="another")
def test_it(config):
    from rebecca.todict import todict
    from dummy import Dummy, to_dict_dummy

    config.set_todict(Dummy, to_dict_dummy)

    dummy = Dummy()
    request = testing.DummyRequest()
    result = todict(request, dummy)

    assert result == dict(value="test")
def test_it(config):
    from rebecca.todict import todict
    import dummy
    import venusian

    config.scan(dummy)

    request = testing.DummyRequest()
    person = dummy.Person(name='a', value=100)

    result = todict(request, person)
    
    assert result == dict(username='******', num=100)
Пример #5
0
def view2(request):
    return todict(request, request.context, name="test2")
Пример #6
0
def view1(request):
    return todict(request, request.context)