iso8601.is8601.Utc No Longer Exists
iso8601.UTC is correct datetime UTC field object. iso8601 >= 0.1.12 includes only iso8601.UTC for python3 while both UTC and Utc() for python2. Less then 0.1.12 included both UTC and Utc() for both python2/3. Change-Id: I0f8796fba6725eea013b3f8d9ad33c10a402c524 Closes-Bug: #1715486
This commit is contained in:
parent
e74095da1f
commit
887fa746ae
|
@ -41,7 +41,7 @@ def datetime_or_none(value, tzinfo_aware=False):
|
|||
# NOTE(danms): Legacy objects from sqlalchemy are stored in UTC,
|
||||
# but are returned without a timezone attached.
|
||||
# As a transitional aid, assume a tz-naive object is in UTC.
|
||||
value = value.replace(tzinfo=iso8601.iso8601.Utc())
|
||||
value = value.replace(tzinfo=iso8601.UTC)
|
||||
elif not tzinfo_aware:
|
||||
value = value.replace(tzinfo=None)
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ class TestActionObject(base.DbTestCase):
|
|||
action.save()
|
||||
|
||||
expected_update_at = fake_saved_action['updated_at'].replace(
|
||||
tzinfo=iso8601.iso8601.Utc())
|
||||
tzinfo=iso8601.UTC)
|
||||
|
||||
mock_get_action.assert_called_once_with(
|
||||
self.context, uuid, eager=self.eager)
|
||||
|
@ -181,7 +181,7 @@ class TestCreateDeleteActionObject(base.DbTestCase):
|
|||
action.create()
|
||||
expected_action = self.fake_action.copy()
|
||||
expected_action['created_at'] = expected_action['created_at'].replace(
|
||||
tzinfo=iso8601.iso8601.Utc())
|
||||
tzinfo=iso8601.UTC)
|
||||
mock_create_action.assert_called_once_with(expected_action)
|
||||
self.assertEqual(self.context, action._context)
|
||||
|
||||
|
@ -201,9 +201,9 @@ class TestCreateDeleteActionObject(base.DbTestCase):
|
|||
|
||||
expected_action = fake_deleted_action.copy()
|
||||
expected_action['created_at'] = expected_action['created_at'].replace(
|
||||
tzinfo=iso8601.iso8601.Utc())
|
||||
tzinfo=iso8601.UTC)
|
||||
expected_action['deleted_at'] = expected_action['deleted_at'].replace(
|
||||
tzinfo=iso8601.iso8601.Utc())
|
||||
tzinfo=iso8601.UTC)
|
||||
del expected_action['action_plan']
|
||||
|
||||
uuid = self.fake_action['uuid']
|
||||
|
|
|
@ -60,7 +60,7 @@ class TestActionDescriptionObject(base.DbTestCase):
|
|||
action_desc.create()
|
||||
expected_action_desc = self.fake_action_desc.copy()
|
||||
expected_action_desc['created_at'] = expected_action_desc[
|
||||
'created_at'].replace(tzinfo=iso8601.iso8601.Utc())
|
||||
'created_at'].replace(tzinfo=iso8601.UTC)
|
||||
|
||||
mock_create_action_desc.assert_called_once_with(expected_action_desc)
|
||||
self.assertEqual(self.context, action_desc._context)
|
||||
|
@ -107,9 +107,9 @@ class TestActionDescriptionObject(base.DbTestCase):
|
|||
|
||||
expected_action_desc = fake_deleted_action_desc.copy()
|
||||
expected_action_desc['created_at'] = expected_action_desc[
|
||||
'created_at'].replace(tzinfo=iso8601.iso8601.Utc())
|
||||
'created_at'].replace(tzinfo=iso8601.UTC)
|
||||
expected_action_desc['deleted_at'] = expected_action_desc[
|
||||
'deleted_at'].replace(tzinfo=iso8601.iso8601.Utc())
|
||||
'deleted_at'].replace(tzinfo=iso8601.UTC)
|
||||
|
||||
_id = self.fake_action_desc['id']
|
||||
action_desc = objects.ActionDescription.get(self.context, _id)
|
||||
|
|
|
@ -139,10 +139,10 @@ class TestActionPlanObject(base.DbTestCase):
|
|||
expected_action_plan = fake_saved_action_plan.copy()
|
||||
expected_action_plan[
|
||||
'created_at'] = expected_action_plan['created_at'].replace(
|
||||
tzinfo=iso8601.iso8601.Utc())
|
||||
tzinfo=iso8601.UTC)
|
||||
expected_action_plan[
|
||||
'updated_at'] = expected_action_plan['updated_at'].replace(
|
||||
tzinfo=iso8601.iso8601.Utc())
|
||||
tzinfo=iso8601.UTC)
|
||||
|
||||
uuid = self.fake_action_plan['uuid']
|
||||
action_plan = objects.ActionPlan.get_by_uuid(
|
||||
|
@ -207,7 +207,7 @@ class TestCreateDeleteActionPlanObject(base.DbTestCase):
|
|||
action_plan.create()
|
||||
expected_action_plan = self.fake_action_plan.copy()
|
||||
expected_action_plan['created_at'] = expected_action_plan[
|
||||
'created_at'].replace(tzinfo=iso8601.iso8601.Utc())
|
||||
'created_at'].replace(tzinfo=iso8601.UTC)
|
||||
mock_create_action_plan.assert_called_once_with(expected_action_plan)
|
||||
self.assertEqual(self.context, action_plan._context)
|
||||
|
||||
|
@ -239,9 +239,9 @@ class TestCreateDeleteActionPlanObject(base.DbTestCase):
|
|||
m_soft_delete_action_plan.return_value = fake_deleted_action_plan
|
||||
expected_action_plan = fake_deleted_action_plan.copy()
|
||||
expected_action_plan['created_at'] = expected_action_plan[
|
||||
'created_at'].replace(tzinfo=iso8601.iso8601.Utc())
|
||||
'created_at'].replace(tzinfo=iso8601.UTC)
|
||||
expected_action_plan['deleted_at'] = expected_action_plan[
|
||||
'deleted_at'].replace(tzinfo=iso8601.iso8601.Utc())
|
||||
'deleted_at'].replace(tzinfo=iso8601.UTC)
|
||||
del expected_action_plan['audit']
|
||||
del expected_action_plan['strategy']
|
||||
|
||||
|
|
|
@ -130,9 +130,9 @@ class TestAuditObject(base.DbTestCase):
|
|||
|
||||
expected_audit = fake_saved_audit.copy()
|
||||
expected_audit['created_at'] = expected_audit['created_at'].replace(
|
||||
tzinfo=iso8601.iso8601.Utc())
|
||||
tzinfo=iso8601.UTC)
|
||||
expected_audit['updated_at'] = expected_audit['updated_at'].replace(
|
||||
tzinfo=iso8601.iso8601.Utc())
|
||||
tzinfo=iso8601.UTC)
|
||||
|
||||
uuid = self.fake_audit['uuid']
|
||||
audit = objects.Audit.get_by_uuid(self.context, uuid, eager=self.eager)
|
||||
|
@ -193,7 +193,7 @@ class TestCreateDeleteAuditObject(base.DbTestCase):
|
|||
audit.create()
|
||||
expected_audit = self.fake_audit.copy()
|
||||
expected_audit['created_at'] = expected_audit['created_at'].replace(
|
||||
tzinfo=iso8601.iso8601.Utc())
|
||||
tzinfo=iso8601.UTC)
|
||||
mock_create_audit.assert_called_once_with(expected_audit)
|
||||
self.assertEqual(self.context, audit._context)
|
||||
|
||||
|
@ -210,9 +210,9 @@ class TestCreateDeleteAuditObject(base.DbTestCase):
|
|||
|
||||
expected_audit = fake_deleted_audit.copy()
|
||||
expected_audit['created_at'] = expected_audit['created_at'].replace(
|
||||
tzinfo=iso8601.iso8601.Utc())
|
||||
tzinfo=iso8601.UTC)
|
||||
expected_audit['deleted_at'] = expected_audit['deleted_at'].replace(
|
||||
tzinfo=iso8601.iso8601.Utc())
|
||||
tzinfo=iso8601.UTC)
|
||||
del expected_audit['goal']
|
||||
del expected_audit['strategy']
|
||||
|
||||
|
@ -308,7 +308,7 @@ class TestAuditObjectSendNotifications(base.DbTestCase):
|
|||
fake_deleted_audit['deleted_at'] = datetime.datetime.utcnow()
|
||||
expected_audit = fake_deleted_audit.copy()
|
||||
expected_audit['deleted_at'] = expected_audit['deleted_at'].replace(
|
||||
tzinfo=iso8601.iso8601.Utc())
|
||||
tzinfo=iso8601.UTC)
|
||||
|
||||
m_soft_delete_audit.return_value = fake_deleted_audit
|
||||
m_update_audit.return_value = fake_deleted_audit
|
||||
|
|
|
@ -177,7 +177,7 @@ class TestCreateDeleteAuditTemplateObject(base.DbTestCase):
|
|||
audit_template.create()
|
||||
expected_audit_template = self.fake_audit_template.copy()
|
||||
expected_audit_template['created_at'] = expected_audit_template[
|
||||
'created_at'].replace(tzinfo=iso8601.iso8601.Utc())
|
||||
'created_at'].replace(tzinfo=iso8601.UTC)
|
||||
mock_create_audit_template.assert_called_once_with(
|
||||
expected_audit_template)
|
||||
self.assertEqual(self.context, audit_template._context)
|
||||
|
@ -193,9 +193,9 @@ class TestCreateDeleteAuditTemplateObject(base.DbTestCase):
|
|||
|
||||
expected_audit_template = fake_deleted_audit_template.copy()
|
||||
expected_audit_template['created_at'] = expected_audit_template[
|
||||
'created_at'].replace(tzinfo=iso8601.iso8601.Utc())
|
||||
'created_at'].replace(tzinfo=iso8601.UTC)
|
||||
expected_audit_template['deleted_at'] = expected_audit_template[
|
||||
'deleted_at'].replace(tzinfo=iso8601.iso8601.Utc())
|
||||
'deleted_at'].replace(tzinfo=iso8601.UTC)
|
||||
del expected_audit_template['goal']
|
||||
del expected_audit_template['strategy']
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ class TestGoalObject(base.DbTestCase):
|
|||
goal.create()
|
||||
expected_goal = self.fake_goal.copy()
|
||||
expected_goal['created_at'] = expected_goal['created_at'].replace(
|
||||
tzinfo=iso8601.iso8601.Utc())
|
||||
tzinfo=iso8601.UTC)
|
||||
mock_create_goal.assert_called_once_with(expected_goal)
|
||||
self.assertEqual(self.context, goal._context)
|
||||
|
||||
|
@ -130,9 +130,9 @@ class TestGoalObject(base.DbTestCase):
|
|||
|
||||
expected_goal = fake_deleted_goal.copy()
|
||||
expected_goal['created_at'] = expected_goal['created_at'].replace(
|
||||
tzinfo=iso8601.iso8601.Utc())
|
||||
tzinfo=iso8601.UTC)
|
||||
expected_goal['deleted_at'] = expected_goal['deleted_at'].replace(
|
||||
tzinfo=iso8601.iso8601.Utc())
|
||||
tzinfo=iso8601.UTC)
|
||||
|
||||
uuid = self.fake_goal['uuid']
|
||||
goal = objects.Goal.get_by_uuid(self.context, uuid)
|
||||
|
|
|
@ -269,7 +269,7 @@ class _TestObject(object):
|
|||
self.assertEqual('updated', obj.bar)
|
||||
|
||||
def test_base_attributes(self):
|
||||
dt = datetime.datetime(1955, 11, 5, 0, 0, tzinfo=iso8601.iso8601.Utc())
|
||||
dt = datetime.datetime(1955, 11, 5, 0, 0, tzinfo=iso8601.UTC)
|
||||
datatime = fields.DateTimeField()
|
||||
obj = MyObj(self.context)
|
||||
obj.created_at = dt
|
||||
|
|
|
@ -78,7 +78,7 @@ class TestScoringEngineObject(base.DbTestCase):
|
|||
scoring_engine.create()
|
||||
expected_scoring_engine = self.fake_scoring_engine.copy()
|
||||
expected_scoring_engine['created_at'] = expected_scoring_engine[
|
||||
'created_at'].replace(tzinfo=iso8601.iso8601.Utc())
|
||||
'created_at'].replace(tzinfo=iso8601.UTC)
|
||||
mock_create_scoring_engine.assert_called_once_with(
|
||||
expected_scoring_engine)
|
||||
self.assertEqual(self.context, scoring_engine._context)
|
||||
|
@ -139,9 +139,9 @@ class TestScoringEngineObject(base.DbTestCase):
|
|||
|
||||
expected_scoring_engine = fake_deleted_scoring_engine.copy()
|
||||
expected_scoring_engine['created_at'] = expected_scoring_engine[
|
||||
'created_at'].replace(tzinfo=iso8601.iso8601.Utc())
|
||||
'created_at'].replace(tzinfo=iso8601.UTC)
|
||||
expected_scoring_engine['deleted_at'] = expected_scoring_engine[
|
||||
'deleted_at'].replace(tzinfo=iso8601.iso8601.Utc())
|
||||
'deleted_at'].replace(tzinfo=iso8601.UTC)
|
||||
|
||||
_id = self.fake_scoring_engine['id']
|
||||
scoring_engine = objects.ScoringEngine.get_by_id(self.context, _id)
|
||||
|
|
|
@ -56,7 +56,7 @@ class TestServiceObject(base.DbTestCase):
|
|||
service.create()
|
||||
expected_service = self.fake_service.copy()
|
||||
expected_service['created_at'] = expected_service[
|
||||
'created_at'].replace(tzinfo=iso8601.iso8601.Utc())
|
||||
'created_at'].replace(tzinfo=iso8601.UTC)
|
||||
|
||||
mock_create_service.assert_called_once_with(expected_service)
|
||||
self.assertEqual(self.context, service._context)
|
||||
|
@ -103,9 +103,9 @@ class TestServiceObject(base.DbTestCase):
|
|||
|
||||
expected_service = fake_deleted_service.copy()
|
||||
expected_service['created_at'] = expected_service[
|
||||
'created_at'].replace(tzinfo=iso8601.iso8601.Utc())
|
||||
'created_at'].replace(tzinfo=iso8601.UTC)
|
||||
expected_service['deleted_at'] = expected_service[
|
||||
'deleted_at'].replace(tzinfo=iso8601.iso8601.Utc())
|
||||
'deleted_at'].replace(tzinfo=iso8601.UTC)
|
||||
|
||||
_id = self.fake_service['id']
|
||||
service = objects.Service.get(self.context, _id)
|
||||
|
|
Loading…
Reference in New Issue