def test_current_time_test(self): t = datetime.datetime.now(zoneinfo.gettz('America/New_York')) t = t.replace(year=2015, month=12, day=1, hour=19, minute=5) with mock_datetime_now(t, datetime): i = instance(Tags=[{'Key': 'maid_offhours', 'Value': 'tz=est'}]) f = OffHour({}) p = f.get_tag_value(i) self.assertEqual(p, 'tz=est') tz = f.get_tz('est') self.assertEqual(str(tz), "tzfile('America/New_York')") self.assertEqual(datetime.datetime.now(tz), t) self.assertEqual(t.hour, 19)
def test_current_time_test(self): t = datetime.datetime.now(tzutil.gettz("America/New_York")) t = t.replace(year=2015, month=12, day=1, hour=19, minute=5) with mock_datetime_now(t, datetime): i = instance(Tags=[{"Key": "maid_offhours", "Value": "tz=est"}]) f = OffHour({}) p = f.get_tag_value(i) self.assertEqual(p, "tz=est") tz = f.get_tz("est") self.assertTrue('America/New_York' in str(tz) or 'US/Eastern' in str(tz)) self.assertEqual(datetime.datetime.now(tz), t) self.assertEqual(t.hour, 19)
def test_current_time_test(self): t = datetime.datetime.now(tzutil.gettz("America/New_York")) t = t.replace(year=2015, month=12, day=1, hour=19, minute=5) with mock_datetime_now(t, datetime): i = instance(Tags=[{"Key": "maid_offhours", "Value": "tz=est"}]) f = OffHour({}) p = f.get_tag_value(i) self.assertEqual(p, "tz=est") tz = f.get_tz("est") self.assertTrue( 'America/New_York' in str(tz) or 'US/Eastern' in str(tz)) self.assertEqual(datetime.datetime.now(tz), t) self.assertEqual(t.hour, 19)
def test_current_time_test(self): t = datetime.datetime.now(zoneinfo.gettz('America/New_York')) t = t.replace(year=2015, month=12, day=1, hour=19, minute=5) with mock_datetime_now(t, datetime): i = instance(Tags=[ {'Key': 'maid_offhours', 'Value': 'tz=est'}]) f = OffHour({}) p = f.get_tag_value(i) self.assertEqual(p, 'tz=est') tz = f.get_tz('est') self.assertEqual(str(tz), "tzfile('America/New_York')") self.assertEqual( datetime.datetime.now(tz), t) self.assertEqual(t.hour, 19)