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


Python StorageServer.StorageServer类代码示例

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


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

示例1: test_created_related_actions_multiple_subscribers

    def test_created_related_actions_multiple_subscribers(self):

        collection_name = "sharing_collection"
        subscribers = [self.__subscriber_id, self.__second_subscriber]
        sharing_secret = self.__create_sharing_record(subscribers, collection_name)
        subscribers.append(self.__account_id)

        file = open("../test_resources/XooML.xml")
        manifest_action = UpdateSharedManifestAction(self.__account_id, collection_name, file)
        SharingActionFactory.create_related_sharing_actions(sharing_secret, manifest_action, callback=self.stop)
        sharing_action_list = self.wait()

        self.assertEqual(3, len(sharing_action_list))

        for sharing_action in sharing_action_list:
            user_id = sharing_action.get_user_id()
            self.assertTrue(user_id in subscribers)
            subscribers.remove(user_id)
            self.assertEqual(SharingEvent.UPDATE_MANIFEST, sharing_action.get_action_type())
        self.assertEqual(0, len(subscribers))

        # cleanup
        SharingController.remove_sharing_record_by_secret(sharing_secret, callback=self.stop)
        self.wait()
        for sharing_action in sharing_action_list:
            user_id = sharing_action.get_user_id()
            collection_name = sharing_action.get_collection_name()
            StorageServer.remove_collection(user_id, collection_name, callback=self.stop)
            self.wait()
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:29,代码来源:SharingActionFactoryTests.py

示例2: test_create_related_actions_update_thumbnail

    def test_create_related_actions_update_thumbnail(self):

        collection_name = "sharing_collection"
        subscribers = [self.__subscriber_id]
        sharing_secret = self.__create_sharing_record(subscribers, collection_name)
        subscribers.append(self.__account_id)

        file = open("../test_resources/XooML.xml")
        thumbnail_action = UpdateSharedThumbnailAction(self.__account_id, collection_name, file)
        SharingActionFactory.create_related_sharing_actions(sharing_secret, thumbnail_action, callback=self.stop)
        sharing_action_list = self.wait()

        self.assertEqual(2, len(sharing_action_list))

        for sharing_action in sharing_action_list:
            user_id = sharing_action.get_user_id()
            thumbnail_file = sharing_action.get_associated_file()
            self.assertTrue(thumbnail_file is not None)
            self.assertTrue(user_id in subscribers)
            subscribers.remove(user_id)
            self.assertEqual(SharingEvent.UPDATE_THUMBNAIL, sharing_action.get_action_type())
        self.assertEqual(0, len(subscribers))

        # cleanup
        SharingController.remove_sharing_record_by_secret(sharing_secret, callback=self.stop)
        self.wait()
        for sharing_action in sharing_action_list:
            user_id = sharing_action.get_user_id()
            collection_name = sharing_action.get_collection_name()
            StorageServer.remove_collection(user_id, collection_name, callback=self.stop)
            self.wait()
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:31,代码来源:SharingActionFactoryTests.py

示例3: test_get_sharing_space_info_existing

    def test_get_sharing_space_info_existing(self):

        servers = ['a', 'b', 'c']
        Properties.sharing_space_servers = servers
        collection_name = str(uuid.uuid4())
        subscriber_list = [self.__subscriber_id, self.__second_subscriber_id]
        sharing_secret, subscribers_collections =\
        self.__create_sharing_record(subscriber_list, collection_name)
        load_balancer = SharingLoadBalancer.get_instance()
        load_balancer.get_sharing_space_info(sharing_secret, callback=self.stop)
        server_info = self.wait()
        server_adrs = server_info['server']
        self.assertTrue(server_adrs in servers)

        load_balancer.get_sharing_space_info(sharing_secret, callback=self.stop)
        second_server_info = self.wait()
        second_server_adrs = second_server_info['server']
        self.assertEqual(server_adrs, second_server_adrs)

        #cleanup
        SharingController.remove_sharing_record_by_secret(sharing_secret, callback =self.stop)
        self.wait()
        StorageServer.remove_collection(self.__account_id, collection_name,
            callback=self.stop)
        for subscriber_id in subscribers_collections:
            subscriber_collection = subscribers_collections[subscriber_id]
            StorageServer.remove_collection(subscriber_id, subscriber_collection,
                callback=self.stop)
            self.wait()
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:29,代码来源:LoadBalancerTests.py

示例4: test_create_related_actions_update_note_img

    def test_create_related_actions_update_note_img(self):

        collection_name = "sharing_collection"
        subscribers = [self.__subscriber_id]
        sharing_secret = self.__create_sharing_record(subscribers, collection_name)
        subscribers.append(self.__account_id)

        note_name = "lala_note"
        file = open("../test_resources/XooML.xml")
        note_img_action = UpdateSharedNoteImageAction(self.__account_id, collection_name, note_name, file)
        SharingActionFactory.create_related_sharing_actions(sharing_secret, note_img_action, callback=self.stop)
        sharing_action_list = self.wait()

        self.assertEqual(2, len(sharing_action_list))

        for sharing_action in sharing_action_list:
            user_id = sharing_action.get_user_id()
            actual_note_name = sharing_action.get_note_name()
            self.assertEqual(note_name, actual_note_name)
            self.assertTrue(user_id in subscribers)
            subscribers.remove(user_id)
            self.assertEqual(SharingEvent.UPDATE_NOTE_IMG, sharing_action.get_action_type())
        self.assertEqual(0, len(subscribers))

        # cleanup
        SharingController.remove_sharing_record_by_secret(sharing_secret, callback=self.stop)
        self.wait()
        for sharing_action in sharing_action_list:
            user_id = sharing_action.get_user_id()
            collection_name = sharing_action.get_collection_name()
            StorageServer.remove_collection(user_id, collection_name, callback=self.stop)
            self.wait()
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:32,代码来源:SharingActionFactoryTests.py

示例5: test_create_related_actions_delete_note

    def test_create_related_actions_delete_note(self):

        collection_name = "sharing_collection"
        subscribers = [self.__subscriber_id]
        sharing_secret = self.__create_sharing_record(subscribers, collection_name)
        subscribers.append(self.__account_id)

        note_name = "lala note"
        delete_action = DeleteSharedNoteAction(self.__account_id, collection_name, note_name)

        SharingActionFactory.create_related_sharing_actions(sharing_secret, delete_action, callback=self.stop)
        sharing_action_list = self.wait()

        self.assertEqual(2, len(sharing_action_list))

        for sharing_action in sharing_action_list:
            user_id = sharing_action.get_user_id()
            actual_note_name = sharing_action.get_note_name()
            note_file = sharing_action.get_associated_file()
            self.assertTrue(note_file is None)
            self.assertEqual(note_name, actual_note_name)
            self.assertTrue(user_id in subscribers)
            subscribers.remove(user_id)
            self.assertEqual(SharingEvent.DELETE_NOTE, sharing_action.get_action_type())
        self.assertEqual(0, len(subscribers))

        # cleanup
        SharingController.remove_sharing_record_by_secret(sharing_secret, callback=self.stop)
        self.wait()
        for sharing_action in sharing_action_list:
            user_id = sharing_action.get_user_id()
            collection_name = sharing_action.get_collection_name()
            StorageServer.remove_collection(user_id, collection_name, callback=self.stop)
            self.wait()
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:34,代码来源:SharingActionFactoryTests.py

示例6: test_reshare_already_shared_collection

    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,代码行数:32,代码来源:SharingControllerTests.py

示例7: test_get_sharing_space_server_existing

    def test_get_sharing_space_server_existing(self):

        collection_name = str(uuid.uuid4())
        subscriber_list = [self.__subscriber_id, self.__second_subscriber_id]
        sharing_secret, subscribers_collections =\
        self.__create_sharing_record(subscriber_list, collection_name)

        joker = JokerHelper.get_instance()
        joker.get_sharing_space_server(sharing_secret, callback=self.stop)
        server_adrs1 = self.wait(timeout=10000)
        self.assertIn(server_adrs1, Properties.sharing_space_servers)
        print server_adrs1


        joker.get_sharing_space_server(sharing_secret, callback=self.stop)
        server_adrs2 = self.wait(timeout=10000)
        self.assertIn(server_adrs2, Properties.sharing_space_servers)
        self.assertEqual(server_adrs1, server_adrs2)
        print server_adrs2

        #cleanup
        SharingController.remove_sharing_record_by_secret(sharing_secret, callback =self.stop)
        self.wait()
        StorageServer.remove_collection(self.__account_id, collection_name,
            callback=self.stop)
        for subscriber_id in subscribers_collections:
            subscriber_collection = subscribers_collections[subscriber_id]
            StorageServer.remove_collection(subscriber_id, subscriber_collection,
                callback=self.stop)
            self.wait()
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:30,代码来源:JokerHelperTests.py

示例8: test_remove_non_existing_note

    def test_remove_non_existing_note(self):

        collection_name = "dummy"
        note_name = "dummy"
        StorageServer.remove_note(self.__account_id, collection_name, note_name, callback=self.stop)
        response = self.wait()
        self.assertEqual(StorageResponse.NOT_FOUND, response)
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:7,代码来源:StorageServerTests.py

示例9: test_remove_all_subscribers

    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,代码行数:34,代码来源:SharingControllerTests.py

示例10: __create_collection

    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,代码行数:7,代码来源:SharingSpaceStorageTests.py

示例11: test_copy_collections_between_accounts_different_name

    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,代码行数:29,代码来源:StorageServerTests.py

示例12: test_copy_non_existing_collection_to_another_account

 def test_copy_non_existing_collection_to_another_account(self):
     collection_name = str(uuid.uuid1())
     StorageServer.copy_collection_between_accounts(
         self.__account_id, self.__second_account_id, collection_name, collection_name, callback=self.stop
     )
     response = self.wait()
     self.assertEqual(StorageResponse.NOT_FOUND, response)
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:7,代码来源:StorageServerTests.py

示例13: test_double_deleting_shared_note

    def test_double_deleting_shared_note(self):

        note_name = 'note_name'
        collection_name = 'collection_name'
        #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)

        delete_action = DeleteSharedNoteAction(self.__account_id,
            collection_name, note_name)
        delete_action.execute(callback=self.stop)
        response = self.wait()
        self.assertEqual(StorageResponse.OK, response)

        delete_action2 = DeleteSharedNoteAction(self.__account_id,
            collection_name, note_name)
        delete_action2.execute(callback=self.stop)
        response = self.wait()
        self.assertEqual(StorageResponse.NOT_FOUND, response)

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

示例14: __create_sharing_record

    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,代码行数:25,代码来源:LoadBalancerTests.py

示例15: test_get_non_existing_note

    def test_get_non_existing_note(self):

        collection_name = "col_name"
        note_name = "noteName"
        StorageServer.get_note_from_collection(self.__account_id, collection_name, note_name, callback=self.stop)
        response = self.wait()
        self.assertTrue(response is None)
开发者ID:Fathalian,项目名称:Mindcloud,代码行数:7,代码来源:StorageServerTests.py


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