some hard-coded instances of 'main' were remaining
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 24 Sep 2010 11:29:06 +0000 (13:29 +0200)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 24 Sep 2010 11:29:06 +0000 (13:29 +0200)
system/TestPlc.py
system/TestSliceSfa.py
system/TestUserSfa.py

index ea1c68a..16e61f7 100644 (file)
@@ -1224,28 +1224,26 @@ class TestPlc:
 
     def add_sfa(self):
         "run sfi.py add (on Registry) and sfi.py create (on SM) to form new objects"
-       test_plc=self
-        test_user_sfa=TestUserSfa(test_plc,self.plc_spec['sfa'])
+        test_user_sfa=TestUserSfa(self)
         if not test_user_sfa.add_user(): return False
 
        for slice_spec in self.plc_spec['sfa']['sfa_slice_specs']:
             site_spec = self.locate_site (slice_spec['sitename'])
             test_site = TestSite(self,site_spec)
-           test_slice_sfa=TestSliceSfa(test_plc,test_site,slice_spec)
+           test_slice_sfa=TestSliceSfa(self,test_site,slice_spec)
            if not test_slice_sfa.add_slice(): return False
            if not test_slice_sfa.create_slice(): return False
         return True
 
     def update_sfa(self):
         "run sfi.py update (on Registry) and sfi.py create (on SM) on existing objects"
-       test_plc=self
-       test_user_sfa=TestUserSfa(test_plc,self.plc_spec['sfa'])
+       test_user_sfa=TestUserSfa(self)
        if not test_user_sfa.update_user(): return False
        
        for slice_spec in self.plc_spec['sfa']['sfa_slice_specs']:
            site_spec = self.locate_site (slice_spec['sitename'])
            test_site = TestSite(self,site_spec)
-           test_slice_sfa=TestSliceSfa(test_plc,test_site,slice_spec)
+           test_slice_sfa=TestSliceSfa(self,test_site,slice_spec)
            if not test_slice_sfa.update_slice(): return False
         return True
 
@@ -1266,13 +1264,12 @@ class TestPlc:
 
     def delete_sfa(self):
        "run sfi.py delete (on SM), sfi.py remove (on Registry)"
-       test_plc=self
-       test_user_sfa=TestUserSfa(test_plc,self.plc_spec['sfa'])
+       test_user_sfa=TestUserSfa(self)
        success1=test_user_sfa.delete_user()
        for slice_spec in self.plc_spec['sfa']['sfa_slice_specs']:
             site_spec = self.locate_site (slice_spec['sitename'])
             test_site = TestSite(self,site_spec)
-           test_slice_sfa=TestSliceSfa(test_plc,test_site,slice_spec)
+           test_slice_sfa=TestSliceSfa(self,test_site,slice_spec)
            success2=test_slice_sfa.delete_slice()
 
        return success1 and success2
index ef8080c..3471a8b 100644 (file)
@@ -16,7 +16,6 @@ class TestSliceSfa:
     def __init__ (self,test_plc,test_site,slice_spec):
        self.test_plc=test_plc
        self.test_site=test_site
-       #self.slice_spec=plc_spec_sfa['slices_sfa'][0]
        self.slice_spec=slice_spec
         self.test_ssh=TestSsh(self.test_plc.test_ssh)
         # shortcuts
index e578c08..cb84cb6 100644 (file)
@@ -8,23 +8,23 @@ import utils
 
 class TestUserSfa:
 
-    def __init__ (self,test_plc,plc_spec_sfa):
+    def __init__ (self,test_plc):
        self.test_plc=test_plc
-       self.spec_sfa=plc_spec_sfa
-
-    def name(self):
-        return self.user_spec['user_fields']['email']
+        # shortcuts
+        self.sfa_spec=test_plc.plc_spec['sfa']
+        self.piuser=self.sfa_spec['piuser']
+        self.regularuser=self.sfa_spec['regularuser']
+        self.slicename=self.sfa_spec['slicename']
+        self.login_base=self.sfa_spec['login_base']
 
     def add_user (self):
-       return \
-        self.test_plc.run_in_guest("sfi.py -d /root/.sfi/ add  person.xml")==0
+       return self.test_plc.run_in_guest("sfi.py -d /root/.sfi/ add person.xml")==0
 
     def update_user (self):
-       return \
-        self.test_plc.run_in_guest("sfi.py -d /root/.sfi/ update  person.xml")==0
+       return self.test_plc.run_in_guest("sfi.py -d /root/.sfi/ update person.xml")==0
 
     def delete_user(self):
-       auth=self.spec_sfa['SFA_REGISTRY_ROOT_AUTH']
+       auth=self.sfa_spec['SFA_REGISTRY_ROOT_AUTH']
        return \
-       self.test_plc.run_in_guest("sfi.py -d /root/.sfi/ remove -t user %s.main.sfafakeuser1"%auth)==0
+            self.test_plc.run_in_guest("sfi.py -d /root/.sfi/ remove -t user %s.%s.%s"%(auth,self.login_base,self.regularuser))==0