def test_copy_and_remove(self): # Choose a test element dsets = sc.lst(self.sock) dsets = dsets['list'] self.assertGreater(len(dsets), 0) test_elt = dsets[0] test_elt_copy = dsets[0]+"copied" # Try and verify a copy operation sc.copy(self.sock, test_elt, test_elt_copy) dsets = sc.lst(self.sock)['list'] self.assertTrue(test_elt_copy in dsets, "Copied element exists") # Try a verify a remove operation sc.remove(self.sock, test_elt_copy) dsets = sc.lst(self.sock)['list'] self.assertTrue(not (test_elt_copy in dsets), "Copied element deleted")
def test_remove_admin(self): # Get a dataset owned by bob sc.auth(self.sock, 'bob', 'bob') dsets = sc.lst(self.sock)['list'] test_elt = dsets[0] cop_elt = test_elt+'copied' sc.copy(self.sock, test_elt, cop_elt) # Verify the copied element is there dsets = sc.lst(self.sock)['list'] self.assertIn(cop_elt, dsets, "Other user's dataset not copied!") # Rename the dataset sc.auth(self.sock, 'lev', 'lev') sc.remove_admin(self.sock, cop_elt, 'bob') # Verify the rename sc.auth(self.sock, 'bob', 'bob') dsets = sc.lst(self.sock)['list'] self.assertNotIn(cop_elt, dsets, "Other user's dataset not removed!") # Put things back the way they were sc.auth(self.sock, 'lev', 'lev')