本文整理汇总了Python中cloudcafe.compute.common.equality_tools.EqualityTools.are_datetimes_equal方法的典型用法代码示例。如果您正苦于以下问题:Python EqualityTools.are_datetimes_equal方法的具体用法?Python EqualityTools.are_datetimes_equal怎么用?Python EqualityTools.are_datetimes_equal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cloudcafe.compute.common.equality_tools.EqualityTools
的用法示例。
在下文中一共展示了EqualityTools.are_datetimes_equal方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_delete_entry_fields_on_delete_server_response
# 需要导入模块: from cloudcafe.compute.common.equality_tools import EqualityTools [as 别名]
# 或者: from cloudcafe.compute.common.equality_tools.EqualityTools import are_datetimes_equal [as 别名]
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))
示例2: validate_exist_entry_audit_period_values
# 需要导入模块: from cloudcafe.compute.common.equality_tools import EqualityTools [as 别名]
# 或者: from cloudcafe.compute.common.equality_tools.EqualityTools import are_datetimes_equal [as 别名]
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)))
示例3: test_exists_entry_fields_on_rescue_server_response
# 需要导入模块: from cloudcafe.compute.common.equality_tools import EqualityTools [as 别名]
# 或者: from cloudcafe.compute.common.equality_tools.EqualityTools import are_datetimes_equal [as 别名]
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),
)
)
示例4: validate_exist_entry_field_values
# 需要导入模块: from cloudcafe.compute.common.equality_tools import EqualityTools [as 别名]
# 或者: from cloudcafe.compute.common.equality_tools.EqualityTools import are_datetimes_equal [as 别名]
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))
示例5: validate_launch_entry_field_values
# 需要导入模块: from cloudcafe.compute.common.equality_tools import EqualityTools [as 别名]
# 或者: from cloudcafe.compute.common.equality_tools.EqualityTools import are_datetimes_equal [as 别名]
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))