def test_rename(self): # Get a list of datasets dsets = sc.lst(self.sock)['list'] # Choose an elt and rename test_elt = dsets[0] test_elt_renamed = dsets[0]+'renamed' sc.rename(self.sock, test_elt, test_elt_renamed) # Get a new list of datasets dsets = sc.lst(self.sock) dsets = dsets['list'] # Make sure original is not present and new one is self.assertTrue( (test_elt_renamed in dsets) and (not (test_elt in dsets)), "Copied element deleted") sc.rename(self.sock, test_elt_renamed, test_elt) # Get a new list of datasets dsets = sc.lst(self.sock) dsets = dsets['list'] # Make sure the second rename also worked self.assertTrue( (not (test_elt_renamed in dsets)) and (not (test_elt in dsets), "Copied element deleted"))
def test_rename_admin(self): # Get a dataset owned by bob sc.auth(self.sock, 'bob', 'bob') dsets = sc.lst(self.sock)['list'] test_elt = dsets[0] ren_elt = test_elt+'renamed' # Rename the dataset sc.auth(self.sock, 'lev', 'lev') sc.rename_admin(self.sock, test_elt, ren_elt, 'bob') # Verify the rename sc.auth(self.sock, 'bob', 'bob') dsets = sc.lst(self.sock)['list'] self.assertIn(ren_elt, dsets, "Other user's dataset not renamed!") # Put things back the way they were sc.rename(self.sock, ren_elt, test_elt) sc.auth(self.sock, 'lev', 'lev')