mirror of
https://github.com/home-assistant/core.git
synced 2025-08-04 13:15:18 +02:00
Revert code cleanup
This commit is contained in:
@@ -42,16 +42,16 @@ class TestComponentsGoogleCalendar(unittest.TestCase):
|
|||||||
@patch('homeassistant.components.calendar.google.GoogleCalendarData')
|
@patch('homeassistant.components.calendar.google.GoogleCalendarData')
|
||||||
def test_all_day_event(self, mock_next_event):
|
def test_all_day_event(self, mock_next_event):
|
||||||
"""Test that we can create an event trigger on device."""
|
"""Test that we can create an event trigger on device."""
|
||||||
week_from_today = dt_util.dt.date.today() + dt_util.dt.timedelta(
|
week_from_today = dt_util.dt.date.today() \
|
||||||
days=7)
|
+ dt_util.dt.timedelta(days=7)
|
||||||
event = {
|
event = {
|
||||||
'summary': 'Test All Day Event',
|
'summary': 'Test All Day Event',
|
||||||
'start': {
|
'start': {
|
||||||
'date': week_from_today.isoformat()
|
'date': week_from_today.isoformat()
|
||||||
},
|
},
|
||||||
'end': {
|
'end': {
|
||||||
'date': (week_from_today + dt_util.dt.timedelta(
|
'date': (week_from_today + dt_util.dt.timedelta(days=1))
|
||||||
days=1)).isoformat()
|
.isoformat()
|
||||||
},
|
},
|
||||||
'location': 'Test Cases',
|
'location': 'Test Cases',
|
||||||
'description': 'We\'re just testing that all day events get setup '
|
'description': 'We\'re just testing that all day events get setup '
|
||||||
@@ -105,14 +105,16 @@ class TestComponentsGoogleCalendar(unittest.TestCase):
|
|||||||
@patch('homeassistant.components.calendar.google.GoogleCalendarData')
|
@patch('homeassistant.components.calendar.google.GoogleCalendarData')
|
||||||
def test_future_event(self, mock_next_event):
|
def test_future_event(self, mock_next_event):
|
||||||
"""Test that we can create an event trigger on device."""
|
"""Test that we can create an event trigger on device."""
|
||||||
one_hour_from_now = dt_util.now() + dt_util.dt.timedelta(minutes=30)
|
one_hour_from_now = dt_util.now() \
|
||||||
|
+ dt_util.dt.timedelta(minutes=30)
|
||||||
event = {
|
event = {
|
||||||
'start': {
|
'start': {
|
||||||
'dateTime': one_hour_from_now.isoformat()
|
'dateTime': one_hour_from_now.isoformat()
|
||||||
},
|
},
|
||||||
'end': {
|
'end': {
|
||||||
'dateTime': (one_hour_from_now
|
'dateTime': (one_hour_from_now
|
||||||
+ dt_util.dt.timedelta(minutes=60)).isoformat()
|
+ dt_util.dt.timedelta(minutes=60))
|
||||||
|
.isoformat()
|
||||||
},
|
},
|
||||||
'summary': 'Test Event in 30 minutes',
|
'summary': 'Test Event in 30 minutes',
|
||||||
'reminders': {'useDefault': True},
|
'reminders': {'useDefault': True},
|
||||||
@@ -155,8 +157,8 @@ class TestComponentsGoogleCalendar(unittest.TestCase):
|
|||||||
'offset_reached': False,
|
'offset_reached': False,
|
||||||
'start_time': one_hour_from_now.strftime(DATE_STR_FORMAT),
|
'start_time': one_hour_from_now.strftime(DATE_STR_FORMAT),
|
||||||
'end_time':
|
'end_time':
|
||||||
(one_hour_from_now + dt_util.dt.timedelta(
|
(one_hour_from_now + dt_util.dt.timedelta(minutes=60))
|
||||||
minutes=60)).strftime(DATE_STR_FORMAT),
|
.strftime(DATE_STR_FORMAT),
|
||||||
'location': '',
|
'location': '',
|
||||||
'description': ''
|
'description': ''
|
||||||
})
|
})
|
||||||
@@ -164,14 +166,16 @@ class TestComponentsGoogleCalendar(unittest.TestCase):
|
|||||||
@patch('homeassistant.components.calendar.google.GoogleCalendarData')
|
@patch('homeassistant.components.calendar.google.GoogleCalendarData')
|
||||||
def test_in_progress_event(self, mock_next_event):
|
def test_in_progress_event(self, mock_next_event):
|
||||||
"""Test that we can create an event trigger on device."""
|
"""Test that we can create an event trigger on device."""
|
||||||
middle_of_event = dt_util.now() - dt_util.dt.timedelta(minutes=30)
|
middle_of_event = dt_util.now() \
|
||||||
|
- dt_util.dt.timedelta(minutes=30)
|
||||||
event = {
|
event = {
|
||||||
'start': {
|
'start': {
|
||||||
'dateTime': middle_of_event.isoformat()
|
'dateTime': middle_of_event.isoformat()
|
||||||
},
|
},
|
||||||
'end': {
|
'end': {
|
||||||
'dateTime': (middle_of_event + dt_util.dt.timedelta(
|
'dateTime': (middle_of_event + dt_util.dt
|
||||||
minutes=60)).isoformat()
|
.timedelta(minutes=60))
|
||||||
|
.isoformat()
|
||||||
},
|
},
|
||||||
'summary': 'Test Event in Progress',
|
'summary': 'Test Event in Progress',
|
||||||
'reminders': {'useDefault': True},
|
'reminders': {'useDefault': True},
|
||||||
@@ -215,8 +219,8 @@ class TestComponentsGoogleCalendar(unittest.TestCase):
|
|||||||
'offset_reached': False,
|
'offset_reached': False,
|
||||||
'start_time': middle_of_event.strftime(DATE_STR_FORMAT),
|
'start_time': middle_of_event.strftime(DATE_STR_FORMAT),
|
||||||
'end_time':
|
'end_time':
|
||||||
(middle_of_event + dt_util.dt.timedelta(minutes=60)).strftime(
|
(middle_of_event + dt_util.dt.timedelta(minutes=60))
|
||||||
DATE_STR_FORMAT),
|
.strftime(DATE_STR_FORMAT),
|
||||||
'location': '',
|
'location': '',
|
||||||
'description': ''
|
'description': ''
|
||||||
})
|
})
|
||||||
@@ -224,15 +228,17 @@ class TestComponentsGoogleCalendar(unittest.TestCase):
|
|||||||
@patch('homeassistant.components.calendar.google.GoogleCalendarData')
|
@patch('homeassistant.components.calendar.google.GoogleCalendarData')
|
||||||
def test_offset_in_progress_event(self, mock_next_event):
|
def test_offset_in_progress_event(self, mock_next_event):
|
||||||
"""Test that we can create an event trigger on device."""
|
"""Test that we can create an event trigger on device."""
|
||||||
middle_of_event = dt_util.now() + dt_util.dt.timedelta(minutes=14)
|
middle_of_event = dt_util.now() \
|
||||||
|
+ dt_util.dt.timedelta(minutes=14)
|
||||||
event_summary = 'Test Event in Progress'
|
event_summary = 'Test Event in Progress'
|
||||||
event = {
|
event = {
|
||||||
'start': {
|
'start': {
|
||||||
'dateTime': middle_of_event.isoformat()
|
'dateTime': middle_of_event.isoformat()
|
||||||
},
|
},
|
||||||
'end': {
|
'end': {
|
||||||
'dateTime': (middle_of_event + dt_util.dt.timedelta(
|
'dateTime': (middle_of_event + dt_util.dt
|
||||||
minutes=60)).isoformat()
|
.timedelta(minutes=60))
|
||||||
|
.isoformat()
|
||||||
},
|
},
|
||||||
'summary': '{} !!-15'.format(event_summary),
|
'summary': '{} !!-15'.format(event_summary),
|
||||||
'reminders': {'useDefault': True},
|
'reminders': {'useDefault': True},
|
||||||
@@ -275,8 +281,9 @@ class TestComponentsGoogleCalendar(unittest.TestCase):
|
|||||||
'all_day': False,
|
'all_day': False,
|
||||||
'offset_reached': True,
|
'offset_reached': True,
|
||||||
'start_time': middle_of_event.strftime(DATE_STR_FORMAT),
|
'start_time': middle_of_event.strftime(DATE_STR_FORMAT),
|
||||||
'end_time': (middle_of_event + dt_util.dt.timedelta(
|
'end_time':
|
||||||
minutes=60)).strftime(DATE_STR_FORMAT),
|
(middle_of_event + dt_util.dt.timedelta(minutes=60))
|
||||||
|
.strftime(DATE_STR_FORMAT),
|
||||||
'location': '',
|
'location': '',
|
||||||
'description': ''
|
'description': ''
|
||||||
})
|
})
|
||||||
@@ -285,7 +292,8 @@ class TestComponentsGoogleCalendar(unittest.TestCase):
|
|||||||
@patch('homeassistant.components.calendar.google.GoogleCalendarData')
|
@patch('homeassistant.components.calendar.google.GoogleCalendarData')
|
||||||
def test_all_day_offset_in_progress_event(self, mock_next_event):
|
def test_all_day_offset_in_progress_event(self, mock_next_event):
|
||||||
"""Test that we can create an event trigger on device."""
|
"""Test that we can create an event trigger on device."""
|
||||||
tomorrow = dt_util.dt.date.today() + dt_util.dt.timedelta(days=1)
|
tomorrow = dt_util.dt.date.today() \
|
||||||
|
+ dt_util.dt.timedelta(days=1)
|
||||||
|
|
||||||
event_summary = 'Test All Day Event Offset In Progress'
|
event_summary = 'Test All Day Event Offset In Progress'
|
||||||
event = {
|
event = {
|
||||||
@@ -294,7 +302,8 @@ class TestComponentsGoogleCalendar(unittest.TestCase):
|
|||||||
'date': tomorrow.isoformat()
|
'date': tomorrow.isoformat()
|
||||||
},
|
},
|
||||||
'end': {
|
'end': {
|
||||||
'date': (tomorrow + dt_util.dt.timedelta(days=1)).isoformat()
|
'date': (tomorrow + dt_util.dt.timedelta(days=1))
|
||||||
|
.isoformat()
|
||||||
},
|
},
|
||||||
'location': 'Test Cases',
|
'location': 'Test Cases',
|
||||||
'description': 'We\'re just testing that all day events get setup '
|
'description': 'We\'re just testing that all day events get setup '
|
||||||
@@ -349,7 +358,8 @@ class TestComponentsGoogleCalendar(unittest.TestCase):
|
|||||||
@patch('homeassistant.components.calendar.google.GoogleCalendarData')
|
@patch('homeassistant.components.calendar.google.GoogleCalendarData')
|
||||||
def test_all_day_offset_event(self, mock_next_event):
|
def test_all_day_offset_event(self, mock_next_event):
|
||||||
"""Test that we can create an event trigger on device."""
|
"""Test that we can create an event trigger on device."""
|
||||||
tomorrow = dt_util.dt.date.today() + dt_util.dt.timedelta(days=2)
|
tomorrow = dt_util.dt.date.today() \
|
||||||
|
+ dt_util.dt.timedelta(days=2)
|
||||||
|
|
||||||
offset_hours = (1 + dt_util.now().hour)
|
offset_hours = (1 + dt_util.now().hour)
|
||||||
event_summary = 'Test All Day Event Offset'
|
event_summary = 'Test All Day Event Offset'
|
||||||
@@ -359,7 +369,8 @@ class TestComponentsGoogleCalendar(unittest.TestCase):
|
|||||||
'date': tomorrow.isoformat()
|
'date': tomorrow.isoformat()
|
||||||
},
|
},
|
||||||
'end': {
|
'end': {
|
||||||
'date': (tomorrow + dt_util.dt.timedelta(days=1)).isoformat()
|
'date': (tomorrow + dt_util.dt.timedelta(days=1))
|
||||||
|
.isoformat()
|
||||||
},
|
},
|
||||||
'location': 'Test Cases',
|
'location': 'Test Cases',
|
||||||
'description': 'We\'re just testing that all day events get setup '
|
'description': 'We\'re just testing that all day events get setup '
|
||||||
|
Reference in New Issue
Block a user