def test_reshare_already_shared_collection(self): # create collection first_collection_name = "shareable_collection" file = open("../test_resources/XooML.xml") StorageServer.add_collection( user_id=self.__account_id, collection_name=first_collection_name, callback=self.stop, file=file ) response = self.wait() self.assertEqual(StorageResponse.OK, response) # create sharing record SharingController.create_sharing_record(self.__account_id, first_collection_name, callback=self.stop) sharing_secret = self.wait() self.assertTrue(sharing_secret is not None) # duplicate create sharing record SharingController.create_sharing_record(self.__account_id, first_collection_name, callback=self.stop) new_sharing_secret = self.wait() self.assertEqual(sharing_secret, new_sharing_secret) # verify that only one sharing record was added SharingController.get_sharing_record_by_owner_info(self.__account_id, first_collection_name, callback=self.stop) sharing_record = self.wait() subscribers_list = sharing_record.get_subscribers() self.assertEqual(1, len(subscribers_list)) # cleanup SharingController.remove_sharing_record_by_secret(sharing_secret, callback=self.stop) self.wait() StorageServer.remove_collection(self.__account_id, first_collection_name, callback=self.stop) self.wait()
def test_get_sharing_record_by_owner_info(self): collection_name = "col_name" SharingController.create_sharing_record(self.__account_id, collection_name, callback=self.stop) sharing_secret = self.wait() self.assertTrue(sharing_secret is not None) SharingController.get_sharing_record_by_owner_info(self.__account_id, collection_name, callback=self.stop) sharing_record = self.wait() actual_sharing_secret = sharing_record.get_sharing_secret() self.assertEqual(sharing_secret, actual_sharing_secret) # cleanup SharingController.remove_sharing_record_by_secret(sharing_secret, callback=self.stop) self.wait()
def test_get_invalid_sharing_record_by_owner_info(self): SharingController.get_sharing_record_by_owner_info(self.__account_id, "dummy", callback=self.stop) sharing_record = self.wait() self.assertTrue(sharing_record is None)