TestUserManager Class Reference

List of all members.


Detailed Description

Class to manage test users.

This class is supposed to provide an interface to

Author:
Enrico Hartung <enrico@iptel.org>
License:
GPL

Definition at line 41 of file TestUserManager.py.


Public Member Functions

def __init__
 Constructor.
def createTestUsers
 Add new users into a sip database and/or include their data into files.
def cleanUpTestUsers
 Do test user clean up.

Private Member Functions

def __addTestUserToDb
 Add a new user into a sip database.
def __addTestUserToFiles
 Include a new users data into files.

Static Private Attributes

 __dbAdapter = None
string __logFilePath = ""

Member Function Documentation

def __init__ (   self,
  dbAdapter = "",
  args = None 
)

Constructor.

Load the database adapter that is given by name.

Parameters:
dbAdapter the name of the database adapter that should be used (string)
args arguments to initialize db adapter (dict)

Definition at line 57 of file TestUserManager.py.

def createTestUsers (   self,
  users,
  files,
  staticUsers 
)

Add new users into a sip database and/or include their data into files.

Therefore three different modes are available:

  • 'all' - write user data into database and files
  • 'db_only' - write user data into database only
  • 'files_only' - write user data into files only

If the user data should be included in any kind of config file, please make sure to have a template file with same name + ".tmpl" in the same directory (e.g. test.csv.tmpl to create test.csv). In the templates tags of following format are expected: [#<name of test user>_<attribute>#] (e.g. [#U1_UUID#])

Possible attributes are:

  • UUID - the unique user id
  • USERNAME - the username
  • AUTHNAME - the name used for authentication
  • REALM - the realm
  • DOMAIN - the domain
  • PASSWORD - the password in plain text
  • HA1 - the password as md5 hash (<username><realm><password>)
  • HA1B - the password as md5 hash (<username><realm><password>)

File names of files to be adapted have to be provided in a dictionary of file groups. Each file group consists of a name (key) and a list of file names (value).

e.g. <"default" : [a.xml, b.xml], "test" : [c.xml, b.xml]>

Parameters:
users list of users (list of testenv.core.TestUser)
files groups of files to be adapted (dict)
staticUsers add test users to database or use existing ones (boolean)
Returns:
all file groups (dict)

Definition at line 126 of file TestUserManager.py.

def __addTestUserToDb (   self,
  user 
) [private]

Add a new user into a sip database.

Parameters:
user the data needed to create a new user (testenv.core.TestUser)

Definition at line 168 of file TestUserManager.py.

def __addTestUserToFiles (   self,
  user,
  files 
) [private]

Include a new users data into files.

If the user data should be included in any kind of config file, please make sure to have a template file with same name + ".tmpl" in the same directory (e.g. test.csv.tmpl to create test.csv). In the templates tags of following format are expected: [#<name of test user>_<attribute>#] (e.g. [#U1_UUID#])

Possible attributes are:

  • UUID - the unique user id
  • SCHEME - scheme of user uri (e.g. 'sip')
  • USERNAME - the username
  • AUTHNAME - the name used for authentication
  • REALM - the realm
  • DOMAIN - the domain
  • PASSWORD - the password in plain text
  • HA1 - the password as md5 hash (<username><realm><password>)
  • HA1B - the password as md5 hash (<username><realm><password>)

File names of files to be adapted have to be provided in a dictionary of file groups. Each file group consists of a name (key) and a list of file names (value).

e.g. <"default" : [a.xml, b.xml], "test" : [c.xml, b.xml]>

Parameters:
user the data needed to create a new user (testenv.core.TestUser)
files groups of files which should be updated (dict)

Definition at line 197 of file TestUserManager.py.

def cleanUpTestUsers (   self,
  users,
  files,
  staticUsers 
)

Do test user clean up.

Therefore all allocated ressources are freed.

Steps to be done:

  • Remove test user from database
  • Remove create files

Parameters:
users list of users (list of testenv.core.TestUser)
files list of files to be removed (list of string)
staticUsers add test users to database or use existing ones ("yes" or "no") (string)

Definition at line 290 of file TestUserManager.py.


Member Data Documentation

__dbAdapter = None [static, private]

Definition at line 42 of file TestUserManager.py.

string __logFilePath = "" [static, private]

Definition at line 45 of file TestUserManager.py.


The documentation for this class was generated from the following file:

Generated on Mon Aug 11 17:28:33 2008 for TestEnv by  doxygen 1.5.5