def test_find_best_collection_name_with_multiple_existing_collections(self): collection_name = "name" StorageServer.add_collection(self.__account_id, collection_name, callback=self.stop) response = self.wait() self.assertEqual(StorageResponse.OK, response) second_collection_name = collection_name + StorageUtils.SHARING_POSTFIX StorageServer.add_collection(self.__account_id, second_collection_name, callback=self.stop) response = self.wait() self.assertEqual(StorageResponse.OK, response) third_collection_name = second_collection_name + "1" StorageServer.add_collection(self.__account_id, third_collection_name, callback=self.stop) response = self.wait() self.assertEqual(StorageResponse.OK, response) StorageUtils.find_best_collection_name_for_user(collection_name, self.__account_id, callback=self.stop) new_name = self.wait() expected_new_name = collection_name + StorageUtils.SHARING_POSTFIX + "2" self.assertEqual(expected_new_name, new_name) # cleanup StorageServer.remove_collection(self.__account_id, collection_name, callback=self.stop) self.wait() StorageServer.remove_collection(self.__account_id, second_collection_name, callback=self.stop) self.wait() StorageServer.remove_collection(self.__account_id, third_collection_name, callback=self.stop) self.wait()
def test_find_best_collection_name_with_unique_collection_name(self): collection_name = str(uuid.uuid1()) StorageUtils.find_best_collection_name_for_user(collection_name, self.__account_id, callback=self.stop) new_name = self.wait() self.assertEqual(collection_name, new_name)