def test_setup_component_with_no_calendar_matching(self, req_mock): """Test setup component with wrong calendar.""" def _add_device(devices): assert not devices caldav.setup_platform( self.hass, { "url": "http://test.local", "calendars": ["none"], "custom_calendars": [] }, _add_device)
def test_setup_component_with_no_calendar_matching(self, req_mock): """Test setup component with wrong calendar.""" def _add_device(devices): assert not devices caldav.setup_platform(self.hass, { "url": "http://test.local", "calendars": ["none"], "custom_calendars": [] }, _add_device)
def test_setup_component_with_a_calendar_match(self, req_mock): """Test setup component with right calendar.""" def _add_device(devices): assert len(devices) == 1 assert devices[0].name == "Second" caldav.setup_platform( self.hass, { "url": "http://test.local", "calendars": ["Second"], "custom_calendars": [] }, _add_device)
def test_setup_component_with_a_calendar_match(self, req_mock): """Test setup component with right calendar.""" def _add_device(devices): assert len(devices) == 1 assert devices[0].name == "Second" caldav.setup_platform(self.hass, { "url": "http://test.local", "calendars": ["Second"], "custom_calendars": [] }, _add_device)
def test_setup_component(self, req_mock): """Test setup component with calendars.""" def _add_device(devices): assert len(devices) == 2 assert devices[0].name == "First" assert devices[0].dev_id == "First" assert devices[1].name == "Second" assert devices[1].dev_id == "Second" caldav.setup_platform(self.hass, { "url": "http://test.local", "custom_calendars": [] }, _add_device)
def test_setup_component(self, req_mock): """Test setup component with calendars.""" def _add_device(devices): assert len(devices) == 2 assert devices[0].name == "First" assert devices[0].dev_id == "First" self.assertFalse(devices[0].data.include_all_day) assert devices[1].name == "Second" assert devices[1].dev_id == "Second" self.assertFalse(devices[1].data.include_all_day) caldav.setup_platform(self.hass, { "url": "http://test.local", "custom_calendars": [] }, _add_device)
def test_setup_component_with_one_custom_calendar(self, req_mock): """Test setup component with custom calendars.""" def _add_device(devices): assert len(devices) == 1 assert devices[0].name == "HomeOffice" assert devices[0].dev_id == "Second HomeOffice" caldav.setup_platform( self.hass, { "url": "http://test.local", "custom_calendars": [{ "name": "HomeOffice", "calendar": "Second", "filter": "HomeOffice" }] }, _add_device)
def test_setup_component_with_one_custom_calendar(self, req_mock): """Test setup component with custom calendars.""" def _add_device(devices): assert len(devices) == 1 assert devices[0].name == "HomeOffice" assert devices[0].dev_id == "Second HomeOffice" self.assertTrue(devices[0].data.include_all_day) caldav.setup_platform(self.hass, { "url": "http://test.local", "custom_calendars": [ { "name": "HomeOffice", "calendar": "Second", "filter": "HomeOffice" }] }, _add_device)