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)
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)
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())