当前位置: 首页>>代码示例>>Python>>正文


Python StorageServer.add_collection方法代码示例

本文整理汇总了Python中Storage.StorageServer.StorageServer.add_collection方法的典型用法代码示例。如果您正苦于以下问题:Python StorageServer.add_collection方法的具体用法?Python StorageServer.add_collection怎么用?Python StorageServer.add_collection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Storage.StorageServer.StorageServer的用法示例。


在下文中一共展示了StorageServer.add_collection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __create_collection

# 需要导入模块: from Storage.StorageServer import StorageServer [as 别名]
# 或者: from Storage.StorageServer.StorageServer import add_collection [as 别名]
    def __create_collection(self, account_id, collection_name):

        file = open('../test_resources/XooML.xml')
        StorageServer.add_collection(user_id= account_id,
            collection_name=collection_name, callback=self.stop, file= file)
        response = self.wait(timeout=100)
        self.assertEqual(StorageResponse.OK, response)
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:9,代码来源:SharingSpaceStorageTests.py

示例2: test_update_sharing_note

# 需要导入模块: from Storage.StorageServer import StorageServer [as 别名]
# 或者: from Storage.StorageServer.StorageServer import add_collection [as 别名]
    def test_update_sharing_note(self):

        #create collection
        collection_name = 'shareable_collection'
        file = open('../test_resources/XooML.xml')
        StorageServer.add_collection(user_id=self.__account_id,
            collection_name=collection_name, callback=self.stop, file= file)
        response = self.wait()
        self.assertEqual(StorageResponse.OK, response)

        #add note
        note_name = "noteName"
        note_file = open('../test_resources/note.xml')
        StorageServer.add_note_to_collection(self.__account_id,
            collection_name, note_name, note_file, callback = self.stop)
        response = self.wait()
        self.assertEqual(StorageResponse.OK, response)

        #update note
        note_file = open('../test_resources/note2.xml')
        update_note_action = UpdateSharedNoteAction(self.__account_id, collection_name,
            note_name, note_file)
        update_note_action.execute(callback=self.stop)
        response = self.wait()
        self.assertEqual(StorageResponse.OK, response)

        #cleanup
        StorageServer.remove_collection(self.__account_id, collection_name,
            callback=self.stop)
        self.wait()
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:32,代码来源:SharingActionTests.py

示例3: test_copy_collections_between_accounts_different_name

# 需要导入模块: from Storage.StorageServer import StorageServer [as 别名]
# 或者: from Storage.StorageServer.StorageServer import add_collection [as 别名]
    def test_copy_collections_between_accounts_different_name(self):

        first_collection_name = str(uuid.uuid1())
        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)

        second_collection_name = str(uuid.uuid1())
        StorageServer.copy_collection_between_accounts(
            self.__account_id,
            self.__second_account_id,
            first_collection_name,
            second_collection_name,
            callback=self.stop,
        )
        response = self.wait()
        self.assertEqual(StorageResponse.OK, response)

        StorageServer.list_collections(self.__second_account_id, callback=self.stop)
        col_list = self.wait()
        self.assertTrue(second_collection_name in col_list)
        # cleanup
        StorageServer.remove_collection(self.__account_id, first_collection_name, callback=self.stop)
        self.wait()
        StorageServer.remove_collection(self.__second_account_id, second_collection_name, callback=self.stop)
        self.wait()
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:31,代码来源:StorageServerTests.py

示例4: __create_sharing_record

# 需要导入模块: from Storage.StorageServer import StorageServer [as 别名]
# 或者: from Storage.StorageServer.StorageServer import add_collection [as 别名]
    def __create_sharing_record(self, subscriber_list, collection_name):

        #create collection
        file = open('../test_resources/XooML.xml')
        StorageServer.add_collection(user_id=self.__account_id,
            collection_name= 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,
            collection_name, callback = self.stop)
        sharing_secret = self.wait(timeout=10000)
        self.assertTrue(sharing_secret is not None)

        subscribers = {}
        for subscriber_id in subscriber_list:
            #subscribe
            SharingController.subscribe_to_sharing_space(subscriber_id,
                sharing_secret, callback = self.stop)
            subscribers_collection_name  = self.wait()
            self.assertTrue(subscribers_collection_name is not None)
            subscribers[subscriber_id] = subscribers_collection_name

        return sharing_secret, subscribers
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:27,代码来源:LoadBalancerTests.py

示例5: test_update_sharing_thumbnail

# 需要导入模块: from Storage.StorageServer import StorageServer [as 别名]
# 或者: from Storage.StorageServer.StorageServer import add_collection [as 别名]
    def test_update_sharing_thumbnail(self):

        first_collection_name = 'shareable_collection_thumbnail'
        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)

        #add thumbnail
        file = open('../test_resources/note_img.jpg')
        StorageServer.add_thumbnail(self.__account_id, first_collection_name,
            file, callback=self.stop)
        response = self.wait()
        self.assertEqual(StorageResponse.OK, response)

        #update thumnail action
        file = open('../test_resources/note_img2.jpg')
        update_thumbnail_action = UpdateSharedThumbnailAction(self.__account_id,
            first_collection_name, file)
        update_thumbnail_action.execute(callback=self.stop)
        response = self.wait()
        self.assertEqual(StorageResponse.OK, response)

        #cleanup
        StorageServer.remove_collection(self.__account_id, first_collection_name,
            callback=self.stop)
        self.wait()
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:30,代码来源:SharingActionTests.py

示例6: test_reshare_already_shared_collection

# 需要导入模块: from Storage.StorageServer import StorageServer [as 别名]
# 或者: from Storage.StorageServer.StorageServer import add_collection [as 别名]
    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()
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:34,代码来源:SharingControllerTests.py

示例7: test_remove_all_subscribers

# 需要导入模块: from Storage.StorageServer import StorageServer [as 别名]
# 或者: from Storage.StorageServer.StorageServer import add_collection [as 别名]
    def test_remove_all_subscribers(self):

        collection_name = "shareable_collection"
        file = open("../test_resources/XooML.xml")
        StorageServer.add_collection(
            user_id=self.__account_id, collection_name=collection_name, callback=self.stop, file=file
        )
        response = self.wait()

        self.assertEqual(StorageResponse.OK, response)

        SharingController.create_sharing_record(self.__account_id, collection_name, callback=self.stop)
        sharing_secret = self.wait()

        SharingController.subscribe_to_sharing_space(self.__subscriber_id, sharing_secret, callback=self.stop)
        collection_name2 = self.wait(timeout=500)

        SharingController.remove_all_subscribers(sharing_secret, callback=self.stop)
        self.wait(timeout=10000)

        # busy wait for the results of remove all subscribers to become consistent
        try:
            self.wait(timeout=5)
        except Exception:
            pass

        SharingController.get_sharing_secret_from_subscriber_info(
            self.__account_id, collection_name, callback=self.stop
        )
        actual_sharing_secret = self.wait()
        self.assertTrue(actual_sharing_secret is None)
        SharingController.get_sharing_secret_from_subscriber_info("second_user", collection_name2, callback=self.stop)
        actual_sharing_secret = self.wait()
        self.assertTrue(actual_sharing_secret is None)
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:36,代码来源:SharingControllerTests.py

示例8: test_remove_collection_with_no_file

# 需要导入模块: from Storage.StorageServer import StorageServer [as 别名]
# 或者: from Storage.StorageServer.StorageServer import add_collection [as 别名]
 def test_remove_collection_with_no_file(self):
     collection_name = str(uuid.uuid1())
     StorageServer.add_collection(self.__account_id, collection_name, callback=self.stop)
     response = self.wait()
     self.assertEqual(StorageResponse.OK, response)
     StorageServer.remove_collection(self.__account_id, collection_name, callback=self.stop)
     response = self.wait()
     self.assertEqual(StorageResponse.OK, response)
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:10,代码来源:StorageServerTests.py

示例9: test_rename_shared_collection_owner

# 需要导入模块: from Storage.StorageServer import StorageServer [as 别名]
# 或者: from Storage.StorageServer.StorageServer import add_collection [as 别名]
    def test_rename_shared_collection_owner(self):

        # create collection
        first_collection_name = "shareable_collection" + str(random.randint)
        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)

        # subscribe
        SharingController.subscribe_to_sharing_space(self.__subscriber_id, sharing_secret, callback=self.stop)
        subscribers_collection_name = self.wait()
        self.assertTrue(subscribers_collection_name is not None)

        # rename
        new_collection_name = "new_name" + str(random.randint)
        SharingController.rename_shared_collection(
            self.__account_id, first_collection_name, new_collection_name, callback=self.stop
        )
        response_code = self.wait()
        self.assertTrue(StorageResponse.OK, response_code)

        # verify
        SharingController.get_sharing_record_by_secret(sharing_secret, callback=self.stop)
        sharing_record = self.wait()
        renamed_collection_name = sharing_record.get_owner_collection_name()
        self.assertEqual(new_collection_name, renamed_collection_name)

        # verify owner collection
        SharingController.get_sharing_secret_from_subscriber_info(
            self.__account_id, new_collection_name, callback=self.stop
        )
        renamed_sharing_secret = self.wait()
        self.assertEqual(sharing_secret, renamed_sharing_secret)

        # verify subscriber collection
        SharingController.get_sharing_record_from_subscriber_info(
            self.__subscriber_id, subscribers_collection_name, callback=self.stop
        )
        renamed_sharing_record = self.wait()
        owner_collection_name = renamed_sharing_record.get_collection_name_for_subscriber(self.__account_id)
        self.assertEqual(new_collection_name, renamed_sharing_record.get_owner_collection_name())
        self.assertEqual(new_collection_name, owner_collection_name)

        # 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()
        StorageServer.remove_collection(self.__subscriber_id, subscribers_collection_name, callback=self.stop)
        self.wait()
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:60,代码来源:SharingControllerTests.py

示例10: test_remove_collection_with_file

# 需要导入模块: from Storage.StorageServer import StorageServer [as 别名]
# 或者: from Storage.StorageServer.StorageServer import add_collection [as 别名]
 def test_remove_collection_with_file(self):
     collection_name = str(uuid.uuid1())
     file = open("../test_resources/XooML.xml")
     StorageServer.add_collection(
         user_id=self.__account_id, collection_name=collection_name, callback=self.stop, file=file
     )
     response = self.wait(timeout=10)
     self.assertEqual(StorageResponse.OK, response)
     StorageServer.remove_collection(self.__account_id, collection_name, callback=self.stop)
     response = self.wait()
     self.assertEqual(StorageResponse.OK, response)
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:13,代码来源:StorageServerTests.py

示例11: test_add_thumbnail

# 需要导入模块: from Storage.StorageServer import StorageServer [as 别名]
# 或者: from Storage.StorageServer.StorageServer import add_collection [as 别名]
 def test_add_thumbnail(self):
     collection_name = str(uuid.uuid1())
     StorageServer.add_collection(self.__account_id, collection_name, callback=self.stop)
     response = self.wait()
     self.assertEqual(StorageResponse.OK, response)
     thumbnail = open("../test_resources/thumbnail.jpg")
     StorageServer.add_thumbnail(self.__account_id, collection_name, thumbnail, callback=self.stop)
     response = self.wait()
     self.assertEqual(StorageResponse.OK, response)
     # cleanup
     StorageServer.remove_collection(self.__account_id, collection_name, callback=self.stop)
     self.wait()
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:14,代码来源:StorageServerTests.py

示例12: test_list_collections_valid_account

# 需要导入模块: from Storage.StorageServer import StorageServer [as 别名]
# 或者: from Storage.StorageServer.StorageServer import add_collection [as 别名]
    def test_list_collections_valid_account(self):
        collection_name = str(uuid.uuid1())
        StorageServer.add_collection(self.__account_id, collection_name, callback=self.stop)
        response = self.wait()
        self.assertEqual(StorageResponse.OK, response)
        StorageServer.list_collections(self.__account_id, callback=self.stop)
        collections = self.wait()
        self.assertTrue(len(collections) > 0)

        # cleanup
        StorageServer.remove_collection(self.__account_id, collection_name, callback=self.stop)
        self.wait()
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:14,代码来源:StorageServerTests.py

示例13: test_does_collection_exist

# 需要导入模块: from Storage.StorageServer import StorageServer [as 别名]
# 或者: from Storage.StorageServer.StorageServer import add_collection [as 别名]
    def test_does_collection_exist(self):
        collection_name = str(uuid.uuid1())
        StorageServer.add_collection(self.__account_id, collection_name, callback=self.stop)
        response = self.wait()
        self.assertEqual(StorageResponse.OK, response)

        StorageServer.does_collection_exist(self.__account_id, collection_name, callback=self.stop)
        response = self.wait()
        self.assertTrue(response)

        # cleanup
        StorageServer.remove_collection(self.__account_id, collection_name, callback=self.stop)
        self.wait()
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:15,代码来源:StorageServerTests.py

示例14: test_save_collection_manifest

# 需要导入模块: from Storage.StorageServer import StorageServer [as 别名]
# 或者: from Storage.StorageServer.StorageServer import add_collection [as 别名]
    def test_save_collection_manifest(self):
        collection_name = "dummy"
        StorageServer.add_collection(self.__account_id, collection_name, callback=self.stop)
        response = self.wait()
        self.assertEqual(StorageResponse.OK, response)
        collection_file = open("../test_resources/collection.xml")
        StorageServer.save_collection_manifest(self.__account_id, collection_name, collection_file, callback=self.stop)
        response = self.wait()
        self.assertEqual(StorageResponse.OK, response)

        # clean up
        StorageServer.remove_collection(self.__account_id, collection_name, callback=self.stop)
        self.wait()
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:15,代码来源:StorageServerTests.py

示例15: test_list_all_notes_empty_collection

# 需要导入模块: from Storage.StorageServer import StorageServer [as 别名]
# 或者: from Storage.StorageServer.StorageServer import add_collection [as 别名]
    def test_list_all_notes_empty_collection(self):

        collection_name = "dummy"
        StorageServer.add_collection(self.__account_id, collection_name, callback=self.stop)
        response = self.wait()
        self.assertEqual(StorageResponse.OK, response)

        StorageServer.list_all_notes(self.__account_id, collection_name, callback=self.stop)
        response = self.wait()
        self.assertEqual(0, len(response))

        # clean up
        StorageServer.remove_collection(self.__account_id, collection_name, callback=self.stop)
        self.wait()
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:16,代码来源:StorageServerTests.py


注:本文中的Storage.StorageServer.StorageServer.add_collection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。