1 # Thierry Parmentelat <thierry.parmentelat@inria.fr>
2 # Copyright (C) 2010 INRIA
11 def __init__ (self,test_auth_sfa, user_spec):
12 self.test_auth_sfa=test_auth_sfa
13 self.user_spec=user_spec
15 self.test_plc=self.test_auth_sfa.test_plc
16 self.login_base=self.test_auth_sfa.login_base
19 return self.test_auth_sfa.sfi_path()
21 return self.test_auth_sfa.obj_hrn(self.user_spec['name'])
22 def sfi_pi(self,*args,**kwds):
23 return self.test_auth_sfa.sfi_pi(*args, **kwds)
24 def sfi_user(self,*args,**kwds):
25 return self.test_auth_sfa.sfi_user(*args, **kwds)
27 # xxx todo - not the right place any longer - or is it ?
28 def sfa_register_user (self,options):
29 "add a regular user using sfi register"
32 command += " --type user"
33 command += " --xrn %s"%user_hrn
34 command += " --email %s"%self.user_spec['email']
35 command += " " + " ".join(self.user_spec['register_options'])
36 # handle key separately because of embedded whitespace
37 # hack - the user's pubkey is avail from his hrn
38 command += " -k %s/%s.pub"%(self.sfi_path(),user_hrn)
39 return self.test_plc.run_in_guest(self.sfi_pi(command))==0
41 def sfa_update_user (self,options):
42 "update a user record using sfi update"
45 command += " --type user"
46 command += " --xrn %s"%user_hrn
47 command += " " + " ".join(self.user_spec['update_options'])
48 return self.test_plc.run_in_guest(self.sfi_pi(command))==0
50 def sfa_delete_user(self,options):
51 "run sfi delete on user record"
53 command="remove -t user %s"%user_hrn
55 self.test_plc.run_in_guest(self.sfi_pi(command))==0