コード例 #1
0
def test_change_email():
    'since hashedemail is our key, if it changes we need to change'
    email = create_random_email()
    person_data = {
        'email':email,
        'displayname':'library testing user',
        'url':'http://testingurls.com',
        'authn':'local',
        'foreign_id':345
    }
    hashed_email = hash_email(email)
    user = DSUser(person_data)
    user.POST()
    assert user._response.success == True
    assert user.email == email
    assert isinstance(user.id,int)
    assert user.id > 0
    user_id = user.id
    uuid = user.user_uniqueid
    new_email = create_random_email()
    user.email = new_email
    user.POST(action='change_email',data={'email':new_email})
    assert user.id == user_id
    assert user.user_uniqueid == uuid
    assert user.displayname == person_data['displayname']
    assert user.email == new_email
    user.DELETE()
    assert user._response.status == 204
コード例 #2
0
 def test_person(self):
     """
     Test the xml get capabilities of person/user account system
     as well as read's
     """
     email = Person.create_random_email()
     
     person_data = {
         'email':email,
         'displayname':'library testing user',
         'url':'http://testingurls.com',
         'authn':'local'
     }
     hashed_email = hash_email(email)
     dsitem = demisauce_ws('person',hashed_email,data=person_data,format='xml')
     assert dsitem.success == True
     print dsitem.data
     plist = [pl for pl in dsitem.model]
     assert len(plist) == 1, 'ensure length of array of nodes is 1'
     p = dsitem.model.person
     assert p != None, 'p should not be none'
     assert p.id > 0, 'userid should be returned'
     assert p.hashedemail == hashed_email
     assert p.email == email
     assert p.displayname == 'library testing user'
     assert p.authn == 'local'
     person_data = {
         'email':email,
         'displayname':'library UPDATE',
         'url':'http://www.google.com',
         'authn':'google'
     }
     dsitem2 = demisauce_ws('person',hashed_email,data=person_data,format='xml')
     assert dsitem2.success == True
     #assert True == False
     print dsitem2.data
     p2 = dsitem2.model
     assert p2.displayname == 'library UPDATE', 'p2.displayname should have been updated'
     assert p2.id == p.id, 'userid should be same as other'
     assert p2.authn == 'google'
コード例 #3
0
ファイル: test_aggregator.py プロジェクト: cccarey/demisauce
 def __init__(self, displayname, email):
     super(Person, self).__init__()
     self.id = 145
     self.displayname = displayname
     self.email = email
     self.hashed_email = hash_email(email)