r1 - 12 Jun 2006 - 15:08:58 - AdamChristianYou are here: OSAF >  Journal Web  >  QualityAssuranceTeam > AdamChristianNotes > AdamChristianJSONRPCTest > AdamChristianScoobyTestingAddingUser

Adding a new user to Cosmo (can be used by scooby)

import random 
from DAVTest import DAVTest

class cosmoAddUser(DAVTest):
    
    def startRun(self):
        
        # ------- Test Create Account ------- #
        
        self.testStart('Setup Accounts')
        
        try:
            self.appendUser = self.appendDict['username']
        except KeyError:
            self.appendUser = ''
           
        cmpheaders = self.headerAdd({'Content-Type' : "text/xml; charset=UTF-8"})
        cmpheaders = self.headerAddAuth("root", "cosmo", headers=cmpheaders)
           
        #CMP path
        cmppath = self.pathBuilder('/cmp/user/cosmo-TestAccount%s' % self.appendUser)
        
        #Create testing account        
        bodycreateaccount = '<?xml version="1.0" encoding="utf-8" ?> \                                 
 <user xmlns="http://osafoundation.org/cosmo/CMP"> \                                   
 <username>cosmoTestAccount%s</username> \                                  
 <password>cosmotest</password> \                                  
 <firstName>cosmoTest</firstName> \                                   
 <lastName>TestAccount</lastName> \                                   
 <email>cosmoTestAccount%s@osafoundation.org</email> \                                   
 </user>' % (self.appendUser, self.appendUser)
                                 
        #Create account and check status
        self.request('PUT', cmppath, body=bodycreateaccount, headers=cmpheaders)
        self.checkStatus(201) # 201 ACCOUNT CREATED
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r1 | More topic actions
 
Open Source Applications Foundation
Except where otherwise noted, this site and its content are licensed by OSAF under an Creative Commons License, Attribution Only 3.0.
See list of page contributors for attributions.