Ejemplo n.º 1
0
def vw_put_user(user_id):
    """ """
    ###
    #session add etc here
    js = request.json
    dolog("INFO", "***PUT:" + repr(js) + str(type(js)))
    ### .. todo:: parse the posted / putted dict???
    try:
        u = usermodel.put_user(js, user_id)
    except:
        abort(401)#.. todo:: meaningful error messages to user please. Flash?
    return "Saved"
Ejemplo n.º 2
0
def test_putuser():

    d = {"user_id": "org.cnx.user-75e06194-baee-4395-8e1a-566b656f6920",
         "email": "wibbleemail", 
         "version": "1.0", 
         "fullname": "wibblename"}

    u = usermodel.put_user(d, "org.cnx.user-75e06194-baee-4395-8e1a-566b656f6920")
    
    assert u.fullname == "wibblename"
    db_session.add(u); db_session.commit()    
    u_fromdb = usermodel.get_user("org.cnx.user-75e06194-baee-4395-8e1a-566b656f6920")
    assert u_fromdb.fullname == "wibblename"    
Ejemplo n.º 3
0
def test_putuser():
#    d = {"interests": null, "identifiers": [{"identifierstring": "https://paulbrian.myopenid.com", "user_id": "org.cnx.user-75e06194-baee-4395-8e1a-566b656f6920", "identifiertype": "openid"}], "user_id": "org.cnx.user-75e06194-baee-4395-8e1a-566b656f6920", "suffix": null, "firstname": null, "title": null, "middlename": null, "lastname": null, "imageurl": null, "otherlangs": null, "affiliationinstitution_url": null, "email": null, "version": null, "location": null, "recommendations": null, "preferredlang": null, "fullname": "Paul Brian", "homepage": null, "affiliationinstitution": null, "biography": null}

    d = {"user_id": "org.cnx.user-75e06194-baee-4395-8e1a-566b656f6920",
         "email": "wibbleemail", 
         "version": "1.0", 
         "fullname": "wibblename"}

    u = usermodel.put_user(d, "org.cnx.user-75e06194-baee-4395-8e1a-566b656f6920")
    
    assert u.fullname == "wibblename"
    db_session.add(u); db_session.commit()    
    u_fromdb = usermodel.get_user("org.cnx.user-75e06194-baee-4395-8e1a-566b656f6920")
    assert u_fromdb.fullname == "wibblename"