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


Python equality_tools.EqualityTools类代码示例

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


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

示例1: validate_exist_entry_audit_period_values

    def validate_exist_entry_audit_period_values(
            self, expected_audit_period_ending,
            expected_audit_period_beginning, event_exist_server=None):
        """
        @summary: Validate that the Exist entry will have all expected values
         related to audit periods
        @param expected_audit_period_ending: The expected audit period ending
            of the server
        @type expected_audit_period_ending: datetime
        @param expected_audit_period_beginning: The expected audit period
            beginning of the server
        @type expected_audit_period_beginning: datetime
        @param event_exist_server: Details of the event Exist from DB
        @type event_exist_server: ServerExists
        """
        self.event_exist_server = self.event_exist
        if event_exist_server:
            self.event_exist_server = event_exist_server

        self.assertTrue(EqualityTools.are_datetimes_equal(
            string_to_datetime(expected_audit_period_ending),
            string_to_datetime(self.event_exist_server.audit_period_ending),
            timedelta(seconds=self.leeway)))
        self.assertTrue(EqualityTools.are_datetimes_equal(
            string_to_datetime(expected_audit_period_beginning),
            string_to_datetime(self.event_exist_server.audit_period_beginning),
            timedelta(seconds=self.leeway)))
        self.assertTrue(EqualityTools.are_datetimes_equal(
            string_to_datetime(expected_audit_period_ending),
            string_to_datetime(self.event_exist_server.received),
            timedelta(seconds=self.leeway)))
开发者ID:cloudkeep,项目名称:cloudroast,代码行数:31,代码来源:fixtures.py

示例2: test_delete_entry_fields_on_delete_server_response

    def test_delete_entry_fields_on_delete_server_response(self):
        """
        Verify that the Delete entry will have all expected fields
        after Server Delete
        """

        self.assertEqual(self.deleted_server.id, self.event_delete.instance,
                         self.msg.format("instance",
                                         self.deleted_server.id,
                                         self.event_delete.instance,
                                         self.delete_response.reason,
                                         self.delete_response.content))
        self.assertTrue(
            EqualityTools.are_datetimes_equal(
                string_to_datetime(self.launched_at_created_server),
                string_to_datetime(self.event_delete.launched_at),
                timedelta(seconds=self.leeway)),
            self.msg.format("launched_at",
                            self.launched_at_created_server,
                            self.event_delete.launched_at,
                            self.delete_response.reason,
                            self.delete_response.content))
        self.assertTrue(
            EqualityTools.are_datetimes_equal(
                string_to_datetime(self.deleted_at),
                string_to_datetime(self.event_delete.deleted_at),
                timedelta(seconds=self.leeway)),
            self.msg.format("deleted_at",
                            self.deleted_at,
                            self.event_delete.deleted_at,
                            self.delete_response.reason,
                            self.delete_response.content))
开发者ID:cloudkeep,项目名称:cloudroast,代码行数:32,代码来源:test_delete_server_in_stacktach_db.py

示例3: test_exists_entry_fields_on_rescue_server_response

 def test_exists_entry_fields_on_rescue_server_response(self):
     """
     Verify that the Exist entry will have all expected fields
     after Server Rescue
     """
     self.validate_exist_entry_field_values(server=self.unrescued_server)
     self.assertTrue(
         EqualityTools.are_datetimes_equal(
             string_to_datetime(self.rescue_start_time),
             string_to_datetime(self.event_exist.audit_period_ending),
             timedelta(seconds=self.leeway),
         )
     )
     self.assertTrue(
         EqualityTools.are_datetimes_equal(
             string_to_datetime(self.audit_period_beginning),
             string_to_datetime(self.event_exist.audit_period_beginning),
             timedelta(seconds=self.leeway),
         )
     )
     self.assertTrue(
         EqualityTools.are_datetimes_equal(
             string_to_datetime(self.rescue_start_time),
             string_to_datetime(self.event_exist.received),
             timedelta(seconds=self.leeway),
         )
     )
开发者ID:jc7998,项目名称:cloudroast,代码行数:27,代码来源:test_server_rescue_in_stacktach_db.py

示例4: test_ram_and_disk_size_on_resize_up_server_revert

    def test_ram_and_disk_size_on_resize_up_server_revert(self):
        """
        The server's RAM and disk space should return to its original
        values after a resize is reverted
        """
        server_response = self.server_behaviors.create_active_server()
        server_to_resize = server_response.entity
        self.resources.add(server_to_resize.id, self.servers_client.delete_server)

        #resize server and revert
        self.servers_client.resize(server_to_resize.id, self.flavor_ref_alt)
        self.server_behaviors.wait_for_server_status(server_to_resize.id, NovaServerStatusTypes.VERIFY_RESIZE)

        self.servers_client.revert_resize(server_to_resize.id)
        reverted_server_response = self.server_behaviors.wait_for_server_status(server_to_resize.id, NovaServerStatusTypes.ACTIVE)
        reverted_server = reverted_server_response.entity
        flavor_response = self.flavors_client.get_flavor_details(self.flavor_ref)
        flavor = flavor_response.entity

        # Verify that the server resize was reverted
        public_address = self.server_behaviors.get_public_ip_address(reverted_server)
        reverted_server.admin_pass = server_to_resize.admin_pass
        remote_instance = self.server_behaviors.get_remote_instance_client(reverted_server,
                                                                           self.servers_config,
                                                                           public_address)

        self.assertEqual(self.flavor_ref, reverted_server.flavor.id,
                         msg="Flavor id not reverted")
        lower_limit = int(flavor.ram) - (int(flavor.ram) * .1)
        server_ram_size = int(remote_instance.get_ram_size_in_mb())
        self.assertTrue(int(flavor.ram) == server_ram_size or lower_limit <= server_ram_size,
                        msg="Ram size after revert did not match.Expected ram size : %s, Actual ram size : %s" % (flavor.ram, server_ram_size))

        self.assertTrue(EqualityTools.are_sizes_equal(flavor.disk, remote_instance.get_disk_size_in_gb(), 0.5),
                        msg="Disk size %s after revert did not match %s" % (remote_instance.get_disk_size_in_gb(), flavor.disk))
开发者ID:nateben,项目名称:cloudroast,代码行数:35,代码来源:test_resize_server_revert.py

示例5: __eq__

 def __eq__(self, other):
     """
     @summary: Overrides the default equals
     @param other: Flavor object to compare with
     @type other: Flavor
     @return: True if Flavor objects are equal, False otherwise
     @rtype: bool
     """
     return EqualityTools.are_objects_equal(self, other)
开发者ID:CharlesKimpolo,项目名称:cloudcafe,代码行数:9,代码来源:limit.py

示例6: __eq__

 def __eq__(self, other):
     """
     @summary: Overrides the default equals
     @param other: Server object to compare with
     @type other: Server
     @return: True if Server objects are equal, False otherwise
     @rtype: bool
     """
     return EqualityTools.are_objects_equal(self, other, ["admin_pass", "updated", "progress"])
开发者ID:pallipuspa,项目名称:cloudcafe,代码行数:9,代码来源:servers.py

示例7: __eq__

 def __eq__(self, other):
     """
     :summary: Overrides the default equals
     :param other: Links object to compare with
     :type other: Links
     :return: True if Links objects are equal, False otherwise
     :rtype: bool
     """
     return EqualityTools.are_objects_equal(self, other)
开发者ID:stanzikratel,项目名称:otter,代码行数:9,代码来源:servers.py

示例8: __ne__

 def __ne__(self, other):
     """
     @summary: Overrides the default not-equals
     @param other: SecurityGroupRule object to compare with
     @type other: SecurityGroupRule
     @return: True if SecurityGroupRule objects
      are not equal, False otherwise
     @rtype: bool
     """
     return not EqualityTools.are_objects_equal(self, other)
开发者ID:CharlesKimpolo,项目名称:cloudcafe,代码行数:10,代码来源:security_group_rule.py

示例9: __eq__

 def __eq__(self, other):
     """
     @summary: Overrides the default equals
     @param other: DiskSize object to compare with
     @type other: DiskSize
     @return: True if DiskSize objects are equal, False otherwise
     @rtype: bool
     """
     return self.unit == other.unit and EqualityTools.are_sizes_equal(
         self.value, other.value,
         self.leeway_for_disk_size)
开发者ID:CharlesKimpolo,项目名称:cloudcafe,代码行数:11,代码来源:partition.py

示例10: test_ram_and_disk_size_on_resize_up_server_confirm_test

    def test_ram_and_disk_size_on_resize_up_server_confirm_test(self):
        """
        The server's RAM and disk space should be modified to that of
        the provided flavor
        """

        new_flavor = self.flavors_client.get_flavor_details(self.flavor_ref).entity
        public_address = self.compute_provider.get_public_ip_address(self.resized_server)
        remote_instance = self.compute_provider.get_remote_instance_client(self.resized_server, public_address)

        lower_limit = int(new_flavor.ram) - (int(new_flavor.ram) * .1)
        server_ram_size = int(remote_instance.get_ram_size_in_mb())
        server_swap_size = int(remote_instance.get_swap_size_in_mb())
        self.assertTrue(int(new_flavor.ram) == server_ram_size or lower_limit <= server_ram_size,
                        msg="Ram size after confirm-resize did not match. Expected ram size : %s, Actual ram size : %s" % (new_flavor.ram, server_ram_size))
        self.assertEquals(int(new_flavor.swap), server_swap_size,
                          msg="Swap size after confirm-resize did not match. Expected swap size: %s, Actual swap size: %s" % (new_flavor.swap, server_swap_size))
        self.assertTrue(EqualityTools.are_sizes_equal(new_flavor.disk, remote_instance.get_disk_size_in_gb(), 0.5),
                        msg="Disk size %s after confirm-resize did not match size %s" % (remote_instance.get_disk_size_in_gb(), new_flavor.disk))
开发者ID:SamDanes,项目名称:cloudroast,代码行数:19,代码来源:test_resize_server_confirm.py

示例11: test_ram_and_disk_size_on_resize_up_server_revert

    def test_ram_and_disk_size_on_resize_up_server_revert(self):
        """
        The server's RAM and disk space should return to its original
        values after a resize is reverted
        """
        server_response = self.compute_provider.create_active_server()
        server_to_resize = server_response.entity
        self.resources.add(server_to_resize.id, self.servers_client.delete_server)
        remote_instance = self.compute_provider.get_remote_instance_client(server_to_resize)
        file_name = rand_name('file') + '.txt'
        file_content = 'This is a test file'
        file_details = remote_instance.create_file(file_name, file_content)

        #resize server and revert
        self.servers_client.resize(server_to_resize.id, self.flavor_ref_alt)
        self.compute_provider.wait_for_server_status(server_to_resize.id, NovaServerStatusTypes.VERIFY_RESIZE)

        self.servers_client.revert_resize(server_to_resize.id)
        reverted_server_response = self.compute_provider.wait_for_server_status(server_to_resize.id, NovaServerStatusTypes.ACTIVE)
        reverted_server = reverted_server_response.entity
        flavor_response = self.flavors_client.get_flavor_details(self.flavor_ref)
        flavor = flavor_response.entity

        '''Verify that the server resize was reverted '''
        public_address = self.compute_provider.get_public_ip_address(reverted_server)
        reverted_server.adminPass = server_to_resize.adminPass
        remote_instance = self.compute_provider.get_remote_instance_client(reverted_server, public_address)
        actual_file_content = remote_instance.get_file_details(file_details.name)

        '''Verify that the file content does not change after resize revert'''
        self.assertEqual(actual_file_content, file_details, msg="file changed after resize revert")

        self.assertEqual(self.flavor_ref, reverted_server.flavor.id,
                         msg="Flavor id not reverted")
        lower_limit = int(flavor.ram) - (int(flavor.ram) * .1)
        server_ram_size = int(remote_instance.get_ram_size_in_mb())
        self.assertTrue(int(flavor.ram) == server_ram_size or lower_limit <= server_ram_size,
                        msg="Ram size after revert did not match.Expected ram size : %s, Actual ram size : %s" % (flavor.ram, server_ram_size))

        self.assertTrue(EqualityTools.are_sizes_equal(flavor.disk, remote_instance.get_disk_size_in_gb(), 0.5),
                        msg="Disk size %s after revert did not match %s" % (remote_instance.get_disk_size_in_gb(), flavor.disk))
开发者ID:SamDanes,项目名称:cloudroast,代码行数:41,代码来源:test_resize_server_revert.py

示例12: __eq__

 def __eq__(self, other):
     return EqualityTools.are_objects_equal(self, other)
开发者ID:cloudkeep,项目名称:cloudcafe,代码行数:2,代码来源:servers.py

示例13: validate_exist_entry_field_values

    def validate_exist_entry_field_values(self, server,
                                          event_exist_server=None,
                                          expected_flavor_ref=None,
                                          launched_at=None):
        """
        @summary: Validate that the Exist entry will have all expected values
        @param server: Details of the server created in test
        @type server: Server
        @param event_exist_server: Details of the event Exist from DB
        @type event_exist_server: ServerExists
        @param expected_flavor_ref: The expected flavor to verify against
        @type expected_flavor_ref: String
        @param launched_at: The launched_at time of the server
        @type launched_at: datetime
        """

        self.event_exist_server = self.event_exist
        if event_exist_server:
            self.event_exist_server = event_exist_server

        self.expected_flavor_ref = self.flavor_ref
        if expected_flavor_ref:
            self.expected_flavor_ref = expected_flavor_ref

        self.launched_at = self.launched_at_created_server
        if launched_at:
            self.launched_at = launched_at

        self.assertEqual(server.id, self.event_exist_server.instance,
                         self.msg.format("instance",
                                         self.created_server.id,
                                         self.event_exist_server.instance,
                                         self.exist_response.reason,
                                         self.exist_response.content))
        self.assertEqual(server.flavor.id,
                         self.event_exist_server.instance_type_id,
                         self.msg.format(
                             "instance_type_id",
                             self.created_server.flavor.id,
                             self.event_exist_server.instance_type_id,
                             self.exist_response.reason,
                             self.exist_response.content))
        self.assertEqual(self.expected_flavor_ref,
                         self.event_exist_server.instance_type_id,
                         self.msg.format(
                             "instance_type_id",
                             self.expected_flavor_ref,
                             self.event_exist_server.instance_type_id,
                             self.exist_response.reason,
                             self.exist_response.content))
        self.assertEqual(self.expected_flavor_ref,
                         self.event_exist_server.instance_flavor_id,
                         self.msg.format(
                             "instance_flavor_id",
                             self.expected_flavor_ref,
                             self.event_exist_server.instance_flavor_id,
                             self.exist_response.reason,
                             self.exist_response.content))
        self.assertIn(self.event_exist_server.status, ['pending', 'verified'],
                      self.msg.format("status",
                                      "Not None, Empty or unexpected value",
                                      self.event_exist_server.status,
                                      self.exist_response.reason,
                                      self.exist_response.content))
        self.assertIn(self.event_exist_server.send_status, [0, 201],
                      self.msg.format("send_status",
                                      "Not None, Empty or unexpected value",
                                      self.event_exist_server.status,
                                      self.exist_response.reason,
                                      self.exist_response.content))
        self.assertTrue(
            EqualityTools.are_datetimes_equal(
                string_to_datetime(self.launched_at),
                string_to_datetime(self.event_exist_server.launched_at),
                timedelta(seconds=self.leeway)),
            self.msg.format("launched_at",
                            self.launched_at,
                            self.event_exist_server.launched_at,
                            self.exist_response.reason,
                            self.exist_response.content))
开发者ID:cloudkeep,项目名称:cloudroast,代码行数:80,代码来源:fixtures.py

示例14: validate_launch_entry_field_values

    def validate_launch_entry_field_values(self, server,
                                           event_launch_server=None,
                                           expected_flavor_ref=None,
                                           launched_at=None):
        """
        @summary: Validate that the Launch entry will have all expected values
        @param server: Details of the server created in test
        @type server: Server
        @param event_launch_server: Details of the event Launch from DB
        @type event_launch_server: ServerLaunch
        @param expected_flavor_ref: The expected flavor to verify against
        @type expected_flavor_ref: String
        @param launched_at: The launched_at time of the server
        @type launched_at: datetime
        """
        self.event_launch_server = self.event_launch
        if event_launch_server:
            self.event_launch_server = event_launch_server

        self.expected_flavor_ref = self.flavor_ref
        if expected_flavor_ref:
            self.expected_flavor_ref = expected_flavor_ref

        self.launched_at = self.launched_at_created_server
        if launched_at:
            self.launched_at = launched_at

        self.assertEqual(server.id,
                         self.event_launch_server.instance,
                         self.msg.format(
                             "instance",
                             server.id,
                             self.event_launch_server.instance,
                             self.launch_response.reason,
                             self.launch_response.content))
        self.assertEqual(server.flavor.id,
                         self.event_launch_server.instance_type_id,
                         self.msg.format(
                             "instance_type_id",
                             server.flavor.id,
                             self.event_launch_server.instance_type_id,
                             self.launch_response.reason,
                             self.launch_response.content))
        self.assertEqual(self.expected_flavor_ref,
                         self.event_launch_server.instance_type_id,
                         self.msg.format(
                             "instance_type_id",
                             self.expected_flavor_ref,
                             self.event_launch_server.instance_type_id,
                             self.launch_response.reason,
                             self.launch_response.content))
        self.assertEqual(self.expected_flavor_ref,
                         self.event_launch_server.instance_flavor_id,
                         self.msg.format(
                             "instance_flavor_id",
                             self.expected_flavor_ref,
                             self.event_launch_server.instance_flavor_id,
                             self.launch_response.reason,
                             self.launch_response.content))
        self.assertTrue(
            EqualityTools.are_datetimes_equal(
                string_to_datetime(self.launched_at),
                string_to_datetime(self.event_launch_server.launched_at),
                timedelta(seconds=self.leeway)),
            self.msg.format("launched_at",
                            self.launched_at,
                            self.event_launch_server.launched_at,
                            self.launch_response.reason,
                            self.launch_response.content))
开发者ID:cloudkeep,项目名称:cloudroast,代码行数:69,代码来源:fixtures.py

示例15: __eq__

 def __eq__(self, other):
     return EqualityTools.are_objects_equal(self, other, ["admin_pass", "updated", "progress"])
开发者ID:vishalkankatala,项目名称:cloudcafe,代码行数:2,代码来源:servers.py


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