コード例 #1
0
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")
コード例 #2
0
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")
コード例 #3
0
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")
コード例 #4
0
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)