Exemplo n.º 1
0
def conversion_from_obj_to_dict_converts_underscores_to_camel_case():
    User = dictobj.data_class("User", ["is_root"])
    
    input_user = User(is_root=True)
    result = dictobj.obj_to_dict(input_user)
    
    expected_dict = {"isRoot": True}
    assert_equal(expected_dict, result)
Exemplo n.º 2
0
def conversion_from_obj_to_dict_uses_hacktastic_fields_property():
    User = dictobj.data_class("User", ["username", "password"])
    
    user = User("bob", "password1")
    result = dictobj.obj_to_dict(user)
    
    expected_dict = {"username": "******", "password": "******"}
    assert_equal(expected_dict, result)
Exemplo n.º 3
0
def converting_object_to_dict_preserves_ordering():
    User = dictobj.data_class("User", [
        "username", "salt", "password", "email_address"
    ])
    
    user = User("bob", "!%ksdg", "password1", "*****@*****.**")
    result = dictobj.obj_to_dict(user)
    
    assert_equal(["username", "salt", "password", "emailAddress"], result.keys())