1 # Thierry Parmentelat <thierry.parmentelat@inria.fr>
2 # Copyright (C) 2010 INRIA
11 def __init__ (self,test_plc,sfa_slice_spec,test_slice_sfa):
12 self.test_plc=test_plc
13 self.sfa_slice_spec=sfa_slice_spec
14 self.test_slice_sfa=test_slice_sfa
16 self.sfa_spec=test_plc.plc_spec['sfa']
17 self.piuser=self.sfa_slice_spec['piuser']
18 self.regularuser=self.sfa_slice_spec['regularuser']
19 self.login_base=self.sfa_slice_spec['login_base']
21 def sfi_path(self): return self.test_slice_sfa.sfi_path()
23 # xxx todo - not the right place any longer - or is it ?
25 sfi_add_options = self.sfa_slice_spec['person_sfi_options']
26 command="sfi -d %s add"%(self.sfi_path())
27 for (opt,val) in sfi_add_options.items():
28 command += " %s %s"%(opt,val)
29 # handle key separately because of embedded whitespace
30 # hack - the user's pubkey is avail from his hrn
31 hrn=sfi_add_options['-x']
32 command += " -k %s/%s.pub"%(self.sfi_path(),hrn)
33 return self.test_plc.run_in_guest(command)==0
35 def update_user (self):
36 # xxx TODO now that we use sfi arguments
37 utils.header ("WARNING: TestUserSfa.update_user needs more work")
40 def delete_user(self):
41 auth=self.sfa_spec['SFA_REGISTRY_ROOT_AUTH']
43 self.test_plc.run_in_guest("sfi -d %s remove -t user %s.%s.%s"%(
44 self.sfi_path(),auth,self.login_base,self.regularuser))==0