Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ============================= test session starts ==============================
- platform darwin -- Python 3.7.4, pytest-5.2.0, py-1.8.0, pluggy-0.12.0
- rootdir: /Users/paulus/dev/hass/home-assistant, inifile: setup.cfg
- plugins: sugar-0.9.2, requests-mock-1.7.0, timeout-1.3.3, cov-2.7.1, aiohttp-0.3.0
- collected 16 items
- tests/components/plex/test_config_flow.py F.......FFF..... [100%]
- =================================== FAILURES ===================================
- _________________________ test_bad_credentials[pyloop] _________________________
- hass = <homeassistant.core.HomeAssistant object at 0x11c3d1410>
- async def test_bad_credentials(hass):
- """Test when provided credentials are rejected."""
- mock_connections = MockConnections()
- mm_plex_account = MagicMock()
- mm_plex_account.resources = Mock(return_value=[MOCK_SERVER_1])
- mm_plex_account.resource = Mock(return_value=mock_connections)
- with patch("plexapi.myplex.MyPlexAccount", return_value=mm_plex_account), patch(
- "plexapi.server.PlexServer", side_effect=plexapi.exceptions.Unauthorized
- ), asynctest.patch("plexauth.PlexAuth.initiate_auth"), asynctest.patch(
- "plexauth.PlexAuth.token", return_value="BAD TOKEN"
- ):
- result = await hass.config_entries.flow.async_init(
- config_flow.DOMAIN, context={"source": "user"}
- )
- assert result["type"] == "form"
- assert result["step_id"] == "start_website_auth"
- result = await hass.config_entries.flow.async_configure(result["flow_id"])
- assert result["type"] == "external"
- result = await hass.config_entries.flow.async_configure(result["flow_id"])
- assert result["type"] == "external_done"
- result = await hass.config_entries.flow.async_configure(result["flow_id"])
- > assert result["type"] == "form"
- E AssertionError: assert 'abort' == 'form'
- E - abort
- E + form
- tests/components/plex/test_config_flow.py:68: AssertionError
- ---------------------------- Captured stderr setup -----------------------------
- DEBUG:asyncio:Using selector: KqueueSelector
- ------------------------------ Captured log setup ------------------------------
- DEBUG asyncio:selector_events.py:53 Using selector: KqueueSelector
- ----------------------------- Captured stderr call -----------------------------
- INFO:homeassistant.loader:Loaded test from custom_components.test
- INFO:homeassistant.loader:Loaded test_package from custom_components.test_package
- INFO:homeassistant.loader:Loaded plex from homeassistant.components.plex
- INFO:homeassistant.loader:Loaded http from homeassistant.components.http
- INFO:homeassistant.setup:Setting up http
- INFO:homeassistant.setup:Setup of domain http took 0.0 seconds.
- DEBUG:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=http>
- DEBUG:homeassistant.core:Bus:Handling <Event data_entry_flow_progressed[L]: handler=plex, flow_id=3dc4b90ca18f4b1fa101d882205e2208, refresh=True>
- ERROR:homeassistant.components.plex:Unknown error connecting to Plex server: 'MockConnections' object has no attribute 'connect'
- ------------------------------ Captured log call -------------------------------
- INFO homeassistant.loader:loader.py:212 Loaded test from custom_components.test
- INFO homeassistant.loader:loader.py:212 Loaded test_package from custom_components.test_package
- INFO homeassistant.loader:loader.py:212 Loaded plex from homeassistant.components.plex
- INFO homeassistant.loader:loader.py:212 Loaded http from homeassistant.components.http
- INFO homeassistant.setup:setup.py:144 Setting up http
- INFO homeassistant.setup:setup.py:184 Setup of domain http took 0.0 seconds.
- DEBUG homeassistant.core:core.py:574 Bus:Handling <Event component_loaded[L]: component=http>
- DEBUG homeassistant.core:core.py:574 Bus:Handling <Event data_entry_flow_progressed[L]: handler=plex, flow_id=3dc4b90ca18f4b1fa101d882205e2208, refresh=True>
- ERROR homeassistant.components.plex:config_flow.py:103 Unknown error connecting to Plex server: 'MockConnections' object has no attribute 'connect'
- --------------------------- Captured stderr teardown ---------------------------
- DEBUG:homeassistant.core:Bus:Handling <Event homeassistant_stop[L]>
- ERROR:homeassistant.core:Error doing job: Task exception was never retrieved
- Traceback (most recent call last):
- File "/Users/paulus/dev/hass/home-assistant/homeassistant/core.py", line 1208, in async_call
- raise ServiceNotFound(domain, service) from None
- homeassistant.exceptions.ServiceNotFound: Unable to find service persistent_notification/dismiss
- DEBUG:homeassistant.core:Bus:Handling <Event homeassistant_close[L]>
- ---------------------------- Captured log teardown -----------------------------
- DEBUG homeassistant.core:core.py:574 Bus:Handling <Event homeassistant_stop[L]>
- ERROR homeassistant.core:core.py:145 Error doing job: Task exception was never retrieved
- Traceback (most recent call last):
- File "/Users/paulus/dev/hass/home-assistant/homeassistant/core.py", line 1208, in async_call
- raise ServiceNotFound(domain, service) from None
- homeassistant.exceptions.ServiceNotFound: Unable to find service persistent_notification/dismiss
- DEBUG homeassistant.core:core.py:574 Bus:Handling <Event homeassistant_close[L]>
- _____________________ test_single_available_server[pyloop] _____________________
- hass = <homeassistant.core.HomeAssistant object at 0x11c3b3990>
- async def test_single_available_server(hass):
- """Test creating an entry with one server available."""
- await async_setup_component(hass, "http", {"http": {}})
- result = await hass.config_entries.flow.async_init(
- config_flow.DOMAIN, context={"source": "user"}
- )
- assert result["type"] == "form"
- assert result["step_id"] == "start_website_auth"
- mock_connections = MockConnections()
- mm_plex_account = MagicMock()
- mm_plex_account.resources = Mock(return_value=[MOCK_SERVER_1])
- mm_plex_account.resource = Mock(return_value=mock_connections)
- with patch("plexapi.myplex.MyPlexAccount", return_value=mm_plex_account), patch(
- "plexapi.server.PlexServer"
- ) as mock_plex_server, asynctest.patch(
- "plexauth.PlexAuth.initiate_auth"
- ), asynctest.patch(
- "plexauth.PlexAuth.token", return_value=MOCK_TOKEN
- ):
- type(mock_plex_server.return_value).machineIdentifier = PropertyMock(
- return_value=MOCK_SERVER_1.clientIdentifier
- )
- type(mock_plex_server.return_value).friendlyName = PropertyMock(
- return_value=MOCK_SERVER_1.name
- )
- type( # pylint: disable=protected-access
- mock_plex_server.return_value
- )._baseurl = PropertyMock(return_value=mock_connections.connections[0].httpuri)
- result = await hass.config_entries.flow.async_configure(result["flow_id"])
- assert result["type"] == "external"
- result = await hass.config_entries.flow.async_configure(result["flow_id"])
- assert result["type"] == "external_done"
- result = await hass.config_entries.flow.async_configure(result["flow_id"])
- > assert result["type"] == "create_entry"
- E AssertionError: assert 'abort' == 'create_entry'
- E - abort
- E + create_entry
- tests/components/plex/test_config_flow.py:302: AssertionError
- ---------------------------- Captured stderr setup -----------------------------
- DEBUG:asyncio:Using selector: KqueueSelector
- ------------------------------ Captured log setup ------------------------------
- DEBUG asyncio:selector_events.py:53 Using selector: KqueueSelector
- ----------------------------- Captured stderr call -----------------------------
- INFO:homeassistant.loader:Loaded test from custom_components.test
- INFO:homeassistant.loader:Loaded test_package from custom_components.test_package
- INFO:homeassistant.loader:Loaded http from homeassistant.components.http
- INFO:homeassistant.setup:Setting up http
- INFO:homeassistant.setup:Setup of domain http took 0.0 seconds.
- DEBUG:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=http>
- INFO:homeassistant.loader:Loaded plex from homeassistant.components.plex
- DEBUG:homeassistant.core:Bus:Handling <Event data_entry_flow_progressed[L]: handler=plex, flow_id=70942ce7af7b40cf8c7b2f15b27fe0cb, refresh=True>
- ERROR:homeassistant.components.plex:Unknown error connecting to Plex server: 'MockConnections' object has no attribute 'connect'
- ------------------------------ Captured log call -------------------------------
- INFO homeassistant.loader:loader.py:212 Loaded test from custom_components.test
- INFO homeassistant.loader:loader.py:212 Loaded test_package from custom_components.test_package
- INFO homeassistant.loader:loader.py:212 Loaded http from homeassistant.components.http
- INFO homeassistant.setup:setup.py:144 Setting up http
- INFO homeassistant.setup:setup.py:184 Setup of domain http took 0.0 seconds.
- DEBUG homeassistant.core:core.py:574 Bus:Handling <Event component_loaded[L]: component=http>
- INFO homeassistant.loader:loader.py:212 Loaded plex from homeassistant.components.plex
- DEBUG homeassistant.core:core.py:574 Bus:Handling <Event data_entry_flow_progressed[L]: handler=plex, flow_id=70942ce7af7b40cf8c7b2f15b27fe0cb, refresh=True>
- ERROR homeassistant.components.plex:config_flow.py:103 Unknown error connecting to Plex server: 'MockConnections' object has no attribute 'connect'
- --------------------------- Captured stderr teardown ---------------------------
- DEBUG:homeassistant.core:Bus:Handling <Event homeassistant_stop[L]>
- ERROR:homeassistant.core:Error doing job: Task exception was never retrieved
- Traceback (most recent call last):
- File "/Users/paulus/dev/hass/home-assistant/homeassistant/core.py", line 1208, in async_call
- raise ServiceNotFound(domain, service) from None
- homeassistant.exceptions.ServiceNotFound: Unable to find service persistent_notification/dismiss
- DEBUG:homeassistant.core:Bus:Handling <Event homeassistant_close[L]>
- ---------------------------- Captured log teardown -----------------------------
- DEBUG homeassistant.core:core.py:574 Bus:Handling <Event homeassistant_stop[L]>
- ERROR homeassistant.core:core.py:145 Error doing job: Task exception was never retrieved
- Traceback (most recent call last):
- File "/Users/paulus/dev/hass/home-assistant/homeassistant/core.py", line 1208, in async_call
- raise ServiceNotFound(domain, service) from None
- homeassistant.exceptions.ServiceNotFound: Unable to find service persistent_notification/dismiss
- DEBUG homeassistant.core:core.py:574 Bus:Handling <Event homeassistant_close[L]>
- _________________ test_multiple_servers_with_selection[pyloop] _________________
- hass = <homeassistant.core.HomeAssistant object at 0x11c3e3410>
- async def test_multiple_servers_with_selection(hass):
- """Test creating an entry with multiple servers available."""
- await async_setup_component(hass, "http", {"http": {}})
- result = await hass.config_entries.flow.async_init(
- config_flow.DOMAIN, context={"source": "user"}
- )
- assert result["type"] == "form"
- assert result["step_id"] == "start_website_auth"
- mock_connections = MockConnections()
- mm_plex_account = MagicMock()
- mm_plex_account.resources = Mock(return_value=[MOCK_SERVER_1, MOCK_SERVER_2])
- mm_plex_account.resource = Mock(return_value=mock_connections)
- with patch("plexapi.myplex.MyPlexAccount", return_value=mm_plex_account), patch(
- "plexapi.server.PlexServer"
- ) as mock_plex_server, asynctest.patch(
- "plexauth.PlexAuth.initiate_auth"
- ), asynctest.patch(
- "plexauth.PlexAuth.token", return_value=MOCK_TOKEN
- ):
- type(mock_plex_server.return_value).machineIdentifier = PropertyMock(
- return_value=MOCK_SERVER_1.clientIdentifier
- )
- type(mock_plex_server.return_value).friendlyName = PropertyMock(
- return_value=MOCK_SERVER_1.name
- )
- type( # pylint: disable=protected-access
- mock_plex_server.return_value
- )._baseurl = PropertyMock(return_value=mock_connections.connections[0].httpuri)
- result = await hass.config_entries.flow.async_configure(result["flow_id"])
- assert result["type"] == "external"
- result = await hass.config_entries.flow.async_configure(result["flow_id"])
- assert result["type"] == "external_done"
- result = await hass.config_entries.flow.async_configure(result["flow_id"])
- assert result["type"] == "form"
- assert result["step_id"] == "select_server"
- result = await hass.config_entries.flow.async_configure(
- result["flow_id"], user_input={config_flow.CONF_SERVER: MOCK_SERVER_1.name}
- )
- > assert result["type"] == "create_entry"
- E AssertionError: assert 'abort' == 'create_entry'
- E - abort
- E + create_entry
- tests/components/plex/test_config_flow.py:362: AssertionError
- ---------------------------- Captured stderr setup -----------------------------
- DEBUG:asyncio:Using selector: KqueueSelector
- ------------------------------ Captured log setup ------------------------------
- DEBUG asyncio:selector_events.py:53 Using selector: KqueueSelector
- ----------------------------- Captured stderr call -----------------------------
- INFO:homeassistant.loader:Loaded test from custom_components.test
- INFO:homeassistant.loader:Loaded test_package from custom_components.test_package
- INFO:homeassistant.loader:Loaded http from homeassistant.components.http
- INFO:homeassistant.setup:Setting up http
- INFO:homeassistant.setup:Setup of domain http took 0.0 seconds.
- DEBUG:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=http>
- INFO:homeassistant.loader:Loaded plex from homeassistant.components.plex
- DEBUG:homeassistant.core:Bus:Handling <Event data_entry_flow_progressed[L]: handler=plex, flow_id=afbf054635b04988ae5c70c0e8738c06, refresh=True>
- ERROR:homeassistant.components.plex:Unknown error connecting to Plex server: 'MockConnections' object has no attribute 'connect'
- ------------------------------ Captured log call -------------------------------
- INFO homeassistant.loader:loader.py:212 Loaded test from custom_components.test
- INFO homeassistant.loader:loader.py:212 Loaded test_package from custom_components.test_package
- INFO homeassistant.loader:loader.py:212 Loaded http from homeassistant.components.http
- INFO homeassistant.setup:setup.py:144 Setting up http
- INFO homeassistant.setup:setup.py:184 Setup of domain http took 0.0 seconds.
- DEBUG homeassistant.core:core.py:574 Bus:Handling <Event component_loaded[L]: component=http>
- INFO homeassistant.loader:loader.py:212 Loaded plex from homeassistant.components.plex
- DEBUG homeassistant.core:core.py:574 Bus:Handling <Event data_entry_flow_progressed[L]: handler=plex, flow_id=afbf054635b04988ae5c70c0e8738c06, refresh=True>
- ERROR homeassistant.components.plex:config_flow.py:103 Unknown error connecting to Plex server: 'MockConnections' object has no attribute 'connect'
- --------------------------- Captured stderr teardown ---------------------------
- DEBUG:homeassistant.core:Bus:Handling <Event homeassistant_stop[L]>
- ERROR:homeassistant.core:Error doing job: Task exception was never retrieved
- Traceback (most recent call last):
- File "/Users/paulus/dev/hass/home-assistant/homeassistant/core.py", line 1208, in async_call
- raise ServiceNotFound(domain, service) from None
- homeassistant.exceptions.ServiceNotFound: Unable to find service persistent_notification/dismiss
- DEBUG:homeassistant.core:Bus:Handling <Event homeassistant_close[L]>
- ---------------------------- Captured log teardown -----------------------------
- DEBUG homeassistant.core:core.py:574 Bus:Handling <Event homeassistant_stop[L]>
- ERROR homeassistant.core:core.py:145 Error doing job: Task exception was never retrieved
- Traceback (most recent call last):
- File "/Users/paulus/dev/hass/home-assistant/homeassistant/core.py", line 1208, in async_call
- raise ServiceNotFound(domain, service) from None
- homeassistant.exceptions.ServiceNotFound: Unable to find service persistent_notification/dismiss
- DEBUG homeassistant.core:core.py:574 Bus:Handling <Event homeassistant_close[L]>
- _________________ test_adding_last_unconfigured_server[pyloop] _________________
- hass = <homeassistant.core.HomeAssistant object at 0x11c480e50>
- async def test_adding_last_unconfigured_server(hass):
- """Test automatically adding last unconfigured server when multiple servers on account."""
- await async_setup_component(hass, "http", {"http": {}})
- MockConfigEntry(
- domain=config_flow.DOMAIN,
- data={
- config_flow.CONF_SERVER_IDENTIFIER: MOCK_ID_2,
- config_flow.CONF_SERVER: MOCK_NAME_2,
- },
- ).add_to_hass(hass)
- result = await hass.config_entries.flow.async_init(
- config_flow.DOMAIN, context={"source": "user"}
- )
- assert result["type"] == "form"
- assert result["step_id"] == "start_website_auth"
- mock_connections = MockConnections()
- mm_plex_account = MagicMock()
- mm_plex_account.resources = Mock(return_value=[MOCK_SERVER_1, MOCK_SERVER_2])
- mm_plex_account.resource = Mock(return_value=mock_connections)
- with patch("plexapi.myplex.MyPlexAccount", return_value=mm_plex_account), patch(
- "plexapi.server.PlexServer"
- ) as mock_plex_server, asynctest.patch(
- "plexauth.PlexAuth.initiate_auth"
- ), asynctest.patch(
- "plexauth.PlexAuth.token", return_value=MOCK_TOKEN
- ):
- type(mock_plex_server.return_value).machineIdentifier = PropertyMock(
- return_value=MOCK_SERVER_1.clientIdentifier
- )
- type(mock_plex_server.return_value).friendlyName = PropertyMock(
- return_value=MOCK_SERVER_1.name
- )
- type( # pylint: disable=protected-access
- mock_plex_server.return_value
- )._baseurl = PropertyMock(return_value=mock_connections.connections[0].httpuri)
- result = await hass.config_entries.flow.async_configure(result["flow_id"])
- assert result["type"] == "external"
- result = await hass.config_entries.flow.async_configure(result["flow_id"])
- assert result["type"] == "external_done"
- result = await hass.config_entries.flow.async_configure(result["flow_id"])
- > assert result["type"] == "create_entry"
- E AssertionError: assert 'abort' == 'create_entry'
- E - abort
- E + create_entry
- tests/components/plex/test_config_flow.py:424: AssertionError
- ---------------------------- Captured stderr setup -----------------------------
- DEBUG:asyncio:Using selector: KqueueSelector
- ------------------------------ Captured log setup ------------------------------
- DEBUG asyncio:selector_events.py:53 Using selector: KqueueSelector
- ----------------------------- Captured stderr call -----------------------------
- INFO:homeassistant.loader:Loaded test from custom_components.test
- INFO:homeassistant.loader:Loaded test_package from custom_components.test_package
- INFO:homeassistant.loader:Loaded http from homeassistant.components.http
- INFO:homeassistant.setup:Setting up http
- INFO:homeassistant.setup:Setup of domain http took 0.0 seconds.
- DEBUG:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=http>
- INFO:homeassistant.loader:Loaded plex from homeassistant.components.plex
- DEBUG:homeassistant.core:Bus:Handling <Event data_entry_flow_progressed[L]: handler=plex, flow_id=92b2f6c2b1df4530a17e7eda632f9d67, refresh=True>
- ERROR:homeassistant.components.plex:Unknown error connecting to Plex server: 'MockConnections' object has no attribute 'connect'
- ------------------------------ Captured log call -------------------------------
- INFO homeassistant.loader:loader.py:212 Loaded test from custom_components.test
- INFO homeassistant.loader:loader.py:212 Loaded test_package from custom_components.test_package
- INFO homeassistant.loader:loader.py:212 Loaded http from homeassistant.components.http
- INFO homeassistant.setup:setup.py:144 Setting up http
- INFO homeassistant.setup:setup.py:184 Setup of domain http took 0.0 seconds.
- DEBUG homeassistant.core:core.py:574 Bus:Handling <Event component_loaded[L]: component=http>
- INFO homeassistant.loader:loader.py:212 Loaded plex from homeassistant.components.plex
- DEBUG homeassistant.core:core.py:574 Bus:Handling <Event data_entry_flow_progressed[L]: handler=plex, flow_id=92b2f6c2b1df4530a17e7eda632f9d67, refresh=True>
- ERROR homeassistant.components.plex:config_flow.py:103 Unknown error connecting to Plex server: 'MockConnections' object has no attribute 'connect'
- --------------------------- Captured stderr teardown ---------------------------
- DEBUG:homeassistant.core:Bus:Handling <Event homeassistant_stop[L]>
- ERROR:homeassistant.core:Error doing job: Task exception was never retrieved
- Traceback (most recent call last):
- File "/Users/paulus/dev/hass/home-assistant/homeassistant/core.py", line 1208, in async_call
- raise ServiceNotFound(domain, service) from None
- homeassistant.exceptions.ServiceNotFound: Unable to find service persistent_notification/dismiss
- DEBUG:homeassistant.core:Bus:Handling <Event homeassistant_close[L]>
- ---------------------------- Captured log teardown -----------------------------
- DEBUG homeassistant.core:core.py:574 Bus:Handling <Event homeassistant_stop[L]>
- ERROR homeassistant.core:core.py:145 Error doing job: Task exception was never retrieved
- Traceback (most recent call last):
- File "/Users/paulus/dev/hass/home-assistant/homeassistant/core.py", line 1208, in async_call
- raise ServiceNotFound(domain, service) from None
- homeassistant.exceptions.ServiceNotFound: Unable to find service persistent_notification/dismiss
- DEBUG homeassistant.core:core.py:574 Bus:Handling <Event homeassistant_close[L]>
- ========================= 4 failed, 12 passed in 1.39s =========================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement