Clean and fix google calendar tests (#23608)
* Clean and fix google calendar tests * Extract test calendar constant for google test * Rewrite google calendar tests * Clean and fix google calendar tests * Clean and fix google component tests * Add google conftest * Skip flaky google calendar test * Fix google calendar bug * Fix yield fixture * Set fixture names to avoid lint warning * Fix yield fixture
This commit is contained in:
1 parent
e24d56aa5b
commit
b9fda078a4
4 files changed
+376
-477
No files matched your search
@@ -0,0 +1,35 @@
|
||||
"""Test configuration and mocks for the google integration."""
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
TEST_CALENDAR = {
|
||||
'id': 'qwertyuiopasdfghjklzxcvbnm@import.calendar.google.com',
|
||||
'etag': '"3584134138943410"',
|
||||
'timeZone': 'UTC',
|
||||
'accessRole': 'reader',
|
||||
'foregroundColor': '#000000',
|
||||
'selected': True,
|
||||
'kind': 'calendar#calendarListEntry',
|
||||
'backgroundColor': '#16a765',
|
||||
'description': 'Test Calendar',
|
||||
'summary': 'We are, we are, a... Test Calendar',
|
||||
'colorId': '8',
|
||||
'defaultReminders': [],
|
||||
'track': True
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def test_calendar():
|
||||
"""Return a test calendar."""
|
||||
return TEST_CALENDAR
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_next_event():
|
||||
"""Mock the google calendar data."""
|
||||
patch_google_cal = patch(
|
||||
'homeassistant.components.google.calendar.GoogleCalendarData')
|
||||
with patch_google_cal as google_cal_data:
|
||||
yield google_cal_data
|
||||
Reference in new issue
Block a user