Ejemplo n.º 1
0
 def test_poll(self):
     """
     Test the xml get capabilities of poll
     
     """
     pollname = Person.create_random_email()
     p = Poll.by_name('what-should-the-new-features-be')
     #print p._xml
     assert p != None
     assert 'features' in p.name
     assert p.questions != None
     assert len(p.questions) > 0
Ejemplo n.º 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'