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