Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.50 KB | None | 0 0
  1. ============================= test session starts ==============================
  2. platform darwin -- Python 3.7.4, pytest-5.2.0, py-1.8.0, pluggy-0.12.0
  3. rootdir: /Users/paulus/dev/hass/home-assistant, inifile: setup.cfg
  4. plugins: sugar-0.9.2, requests-mock-1.7.0, timeout-1.3.3, cov-2.7.1, aiohttp-0.3.0
  5. collected 16 items
  6.  
  7. tests/components/plex/test_config_flow.py F.......FFF..... [100%]
  8.  
  9. =================================== FAILURES ===================================
  10. _________________________ test_bad_credentials[pyloop] _________________________
  11.  
  12. hass = <homeassistant.core.HomeAssistant object at 0x11c3d1410>
  13.  
  14. async def test_bad_credentials(hass):
  15. """Test when provided credentials are rejected."""
  16. mock_connections = MockConnections()
  17. mm_plex_account = MagicMock()
  18. mm_plex_account.resources = Mock(return_value=[MOCK_SERVER_1])
  19. mm_plex_account.resource = Mock(return_value=mock_connections)
  20.  
  21. with patch("plexapi.myplex.MyPlexAccount", return_value=mm_plex_account), patch(
  22. "plexapi.server.PlexServer", side_effect=plexapi.exceptions.Unauthorized
  23. ), asynctest.patch("plexauth.PlexAuth.initiate_auth"), asynctest.patch(
  24. "plexauth.PlexAuth.token", return_value="BAD TOKEN"
  25. ):
  26. result = await hass.config_entries.flow.async_init(
  27. config_flow.DOMAIN, context={"source": "user"}
  28. )
  29. assert result["type"] == "form"
  30. assert result["step_id"] == "start_website_auth"
  31.  
  32. result = await hass.config_entries.flow.async_configure(result["flow_id"])
  33. assert result["type"] == "external"
  34.  
  35. result = await hass.config_entries.flow.async_configure(result["flow_id"])
  36. assert result["type"] == "external_done"
  37.  
  38. result = await hass.config_entries.flow.async_configure(result["flow_id"])
  39.  
  40. > assert result["type"] == "form"
  41. E AssertionError: assert 'abort' == 'form'
  42. E - abort
  43. E + form
  44.  
  45. tests/components/plex/test_config_flow.py:68: AssertionError
  46. ---------------------------- Captured stderr setup -----------------------------
  47. DEBUG:asyncio:Using selector: KqueueSelector
  48. ------------------------------ Captured log setup ------------------------------
  49. DEBUG asyncio:selector_events.py:53 Using selector: KqueueSelector
  50. ----------------------------- Captured stderr call -----------------------------
  51. INFO:homeassistant.loader:Loaded test from custom_components.test
  52. INFO:homeassistant.loader:Loaded test_package from custom_components.test_package
  53. INFO:homeassistant.loader:Loaded plex from homeassistant.components.plex
  54. INFO:homeassistant.loader:Loaded http from homeassistant.components.http
  55. INFO:homeassistant.setup:Setting up http
  56. INFO:homeassistant.setup:Setup of domain http took 0.0 seconds.
  57. DEBUG:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=http>
  58. DEBUG:homeassistant.core:Bus:Handling <Event data_entry_flow_progressed[L]: handler=plex, flow_id=3dc4b90ca18f4b1fa101d882205e2208, refresh=True>
  59. ERROR:homeassistant.components.plex:Unknown error connecting to Plex server: 'MockConnections' object has no attribute 'connect'
  60. ------------------------------ Captured log call -------------------------------
  61. INFO homeassistant.loader:loader.py:212 Loaded test from custom_components.test
  62. INFO homeassistant.loader:loader.py:212 Loaded test_package from custom_components.test_package
  63. INFO homeassistant.loader:loader.py:212 Loaded plex from homeassistant.components.plex
  64. INFO homeassistant.loader:loader.py:212 Loaded http from homeassistant.components.http
  65. INFO homeassistant.setup:setup.py:144 Setting up http
  66. INFO homeassistant.setup:setup.py:184 Setup of domain http took 0.0 seconds.
  67. DEBUG homeassistant.core:core.py:574 Bus:Handling <Event component_loaded[L]: component=http>
  68. DEBUG homeassistant.core:core.py:574 Bus:Handling <Event data_entry_flow_progressed[L]: handler=plex, flow_id=3dc4b90ca18f4b1fa101d882205e2208, refresh=True>
  69. ERROR homeassistant.components.plex:config_flow.py:103 Unknown error connecting to Plex server: 'MockConnections' object has no attribute 'connect'
  70. --------------------------- Captured stderr teardown ---------------------------
  71. DEBUG:homeassistant.core:Bus:Handling <Event homeassistant_stop[L]>
  72. ERROR:homeassistant.core:Error doing job: Task exception was never retrieved
  73. Traceback (most recent call last):
  74. File "/Users/paulus/dev/hass/home-assistant/homeassistant/core.py", line 1208, in async_call
  75. raise ServiceNotFound(domain, service) from None
  76. homeassistant.exceptions.ServiceNotFound: Unable to find service persistent_notification/dismiss
  77. DEBUG:homeassistant.core:Bus:Handling <Event homeassistant_close[L]>
  78. ---------------------------- Captured log teardown -----------------------------
  79. DEBUG homeassistant.core:core.py:574 Bus:Handling <Event homeassistant_stop[L]>
  80. ERROR homeassistant.core:core.py:145 Error doing job: Task exception was never retrieved
  81. Traceback (most recent call last):
  82. File "/Users/paulus/dev/hass/home-assistant/homeassistant/core.py", line 1208, in async_call
  83. raise ServiceNotFound(domain, service) from None
  84. homeassistant.exceptions.ServiceNotFound: Unable to find service persistent_notification/dismiss
  85. DEBUG homeassistant.core:core.py:574 Bus:Handling <Event homeassistant_close[L]>
  86. _____________________ test_single_available_server[pyloop] _____________________
  87.  
  88. hass = <homeassistant.core.HomeAssistant object at 0x11c3b3990>
  89.  
  90. async def test_single_available_server(hass):
  91. """Test creating an entry with one server available."""
  92.  
  93. await async_setup_component(hass, "http", {"http": {}})
  94.  
  95. result = await hass.config_entries.flow.async_init(
  96. config_flow.DOMAIN, context={"source": "user"}
  97. )
  98. assert result["type"] == "form"
  99. assert result["step_id"] == "start_website_auth"
  100.  
  101. mock_connections = MockConnections()
  102.  
  103. mm_plex_account = MagicMock()
  104. mm_plex_account.resources = Mock(return_value=[MOCK_SERVER_1])
  105. mm_plex_account.resource = Mock(return_value=mock_connections)
  106.  
  107. with patch("plexapi.myplex.MyPlexAccount", return_value=mm_plex_account), patch(
  108. "plexapi.server.PlexServer"
  109. ) as mock_plex_server, asynctest.patch(
  110. "plexauth.PlexAuth.initiate_auth"
  111. ), asynctest.patch(
  112. "plexauth.PlexAuth.token", return_value=MOCK_TOKEN
  113. ):
  114. type(mock_plex_server.return_value).machineIdentifier = PropertyMock(
  115. return_value=MOCK_SERVER_1.clientIdentifier
  116. )
  117. type(mock_plex_server.return_value).friendlyName = PropertyMock(
  118. return_value=MOCK_SERVER_1.name
  119. )
  120. type( # pylint: disable=protected-access
  121. mock_plex_server.return_value
  122. )._baseurl = PropertyMock(return_value=mock_connections.connections[0].httpuri)
  123.  
  124. result = await hass.config_entries.flow.async_configure(result["flow_id"])
  125. assert result["type"] == "external"
  126.  
  127. result = await hass.config_entries.flow.async_configure(result["flow_id"])
  128. assert result["type"] == "external_done"
  129.  
  130. result = await hass.config_entries.flow.async_configure(result["flow_id"])
  131. > assert result["type"] == "create_entry"
  132. E AssertionError: assert 'abort' == 'create_entry'
  133. E - abort
  134. E + create_entry
  135.  
  136. tests/components/plex/test_config_flow.py:302: AssertionError
  137. ---------------------------- Captured stderr setup -----------------------------
  138. DEBUG:asyncio:Using selector: KqueueSelector
  139. ------------------------------ Captured log setup ------------------------------
  140. DEBUG asyncio:selector_events.py:53 Using selector: KqueueSelector
  141. ----------------------------- Captured stderr call -----------------------------
  142. INFO:homeassistant.loader:Loaded test from custom_components.test
  143. INFO:homeassistant.loader:Loaded test_package from custom_components.test_package
  144. INFO:homeassistant.loader:Loaded http from homeassistant.components.http
  145. INFO:homeassistant.setup:Setting up http
  146. INFO:homeassistant.setup:Setup of domain http took 0.0 seconds.
  147. DEBUG:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=http>
  148. INFO:homeassistant.loader:Loaded plex from homeassistant.components.plex
  149. DEBUG:homeassistant.core:Bus:Handling <Event data_entry_flow_progressed[L]: handler=plex, flow_id=70942ce7af7b40cf8c7b2f15b27fe0cb, refresh=True>
  150. ERROR:homeassistant.components.plex:Unknown error connecting to Plex server: 'MockConnections' object has no attribute 'connect'
  151. ------------------------------ Captured log call -------------------------------
  152. INFO homeassistant.loader:loader.py:212 Loaded test from custom_components.test
  153. INFO homeassistant.loader:loader.py:212 Loaded test_package from custom_components.test_package
  154. INFO homeassistant.loader:loader.py:212 Loaded http from homeassistant.components.http
  155. INFO homeassistant.setup:setup.py:144 Setting up http
  156. INFO homeassistant.setup:setup.py:184 Setup of domain http took 0.0 seconds.
  157. DEBUG homeassistant.core:core.py:574 Bus:Handling <Event component_loaded[L]: component=http>
  158. INFO homeassistant.loader:loader.py:212 Loaded plex from homeassistant.components.plex
  159. DEBUG homeassistant.core:core.py:574 Bus:Handling <Event data_entry_flow_progressed[L]: handler=plex, flow_id=70942ce7af7b40cf8c7b2f15b27fe0cb, refresh=True>
  160. ERROR homeassistant.components.plex:config_flow.py:103 Unknown error connecting to Plex server: 'MockConnections' object has no attribute 'connect'
  161. --------------------------- Captured stderr teardown ---------------------------
  162. DEBUG:homeassistant.core:Bus:Handling <Event homeassistant_stop[L]>
  163. ERROR:homeassistant.core:Error doing job: Task exception was never retrieved
  164. Traceback (most recent call last):
  165. File "/Users/paulus/dev/hass/home-assistant/homeassistant/core.py", line 1208, in async_call
  166. raise ServiceNotFound(domain, service) from None
  167. homeassistant.exceptions.ServiceNotFound: Unable to find service persistent_notification/dismiss
  168. DEBUG:homeassistant.core:Bus:Handling <Event homeassistant_close[L]>
  169. ---------------------------- Captured log teardown -----------------------------
  170. DEBUG homeassistant.core:core.py:574 Bus:Handling <Event homeassistant_stop[L]>
  171. ERROR homeassistant.core:core.py:145 Error doing job: Task exception was never retrieved
  172. Traceback (most recent call last):
  173. File "/Users/paulus/dev/hass/home-assistant/homeassistant/core.py", line 1208, in async_call
  174. raise ServiceNotFound(domain, service) from None
  175. homeassistant.exceptions.ServiceNotFound: Unable to find service persistent_notification/dismiss
  176. DEBUG homeassistant.core:core.py:574 Bus:Handling <Event homeassistant_close[L]>
  177. _________________ test_multiple_servers_with_selection[pyloop] _________________
  178.  
  179. hass = <homeassistant.core.HomeAssistant object at 0x11c3e3410>
  180.  
  181. async def test_multiple_servers_with_selection(hass):
  182. """Test creating an entry with multiple servers available."""
  183.  
  184. await async_setup_component(hass, "http", {"http": {}})
  185.  
  186. result = await hass.config_entries.flow.async_init(
  187. config_flow.DOMAIN, context={"source": "user"}
  188. )
  189. assert result["type"] == "form"
  190. assert result["step_id"] == "start_website_auth"
  191.  
  192. mock_connections = MockConnections()
  193. mm_plex_account = MagicMock()
  194. mm_plex_account.resources = Mock(return_value=[MOCK_SERVER_1, MOCK_SERVER_2])
  195. mm_plex_account.resource = Mock(return_value=mock_connections)
  196.  
  197. with patch("plexapi.myplex.MyPlexAccount", return_value=mm_plex_account), patch(
  198. "plexapi.server.PlexServer"
  199. ) as mock_plex_server, asynctest.patch(
  200. "plexauth.PlexAuth.initiate_auth"
  201. ), asynctest.patch(
  202. "plexauth.PlexAuth.token", return_value=MOCK_TOKEN
  203. ):
  204. type(mock_plex_server.return_value).machineIdentifier = PropertyMock(
  205. return_value=MOCK_SERVER_1.clientIdentifier
  206. )
  207. type(mock_plex_server.return_value).friendlyName = PropertyMock(
  208. return_value=MOCK_SERVER_1.name
  209. )
  210. type( # pylint: disable=protected-access
  211. mock_plex_server.return_value
  212. )._baseurl = PropertyMock(return_value=mock_connections.connections[0].httpuri)
  213.  
  214. result = await hass.config_entries.flow.async_configure(result["flow_id"])
  215. assert result["type"] == "external"
  216.  
  217. result = await hass.config_entries.flow.async_configure(result["flow_id"])
  218. assert result["type"] == "external_done"
  219.  
  220. result = await hass.config_entries.flow.async_configure(result["flow_id"])
  221. assert result["type"] == "form"
  222. assert result["step_id"] == "select_server"
  223.  
  224. result = await hass.config_entries.flow.async_configure(
  225. result["flow_id"], user_input={config_flow.CONF_SERVER: MOCK_SERVER_1.name}
  226. )
  227. > assert result["type"] == "create_entry"
  228. E AssertionError: assert 'abort' == 'create_entry'
  229. E - abort
  230. E + create_entry
  231.  
  232. tests/components/plex/test_config_flow.py:362: AssertionError
  233. ---------------------------- Captured stderr setup -----------------------------
  234. DEBUG:asyncio:Using selector: KqueueSelector
  235. ------------------------------ Captured log setup ------------------------------
  236. DEBUG asyncio:selector_events.py:53 Using selector: KqueueSelector
  237. ----------------------------- Captured stderr call -----------------------------
  238. INFO:homeassistant.loader:Loaded test from custom_components.test
  239. INFO:homeassistant.loader:Loaded test_package from custom_components.test_package
  240. INFO:homeassistant.loader:Loaded http from homeassistant.components.http
  241. INFO:homeassistant.setup:Setting up http
  242. INFO:homeassistant.setup:Setup of domain http took 0.0 seconds.
  243. DEBUG:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=http>
  244. INFO:homeassistant.loader:Loaded plex from homeassistant.components.plex
  245. DEBUG:homeassistant.core:Bus:Handling <Event data_entry_flow_progressed[L]: handler=plex, flow_id=afbf054635b04988ae5c70c0e8738c06, refresh=True>
  246. ERROR:homeassistant.components.plex:Unknown error connecting to Plex server: 'MockConnections' object has no attribute 'connect'
  247. ------------------------------ Captured log call -------------------------------
  248. INFO homeassistant.loader:loader.py:212 Loaded test from custom_components.test
  249. INFO homeassistant.loader:loader.py:212 Loaded test_package from custom_components.test_package
  250. INFO homeassistant.loader:loader.py:212 Loaded http from homeassistant.components.http
  251. INFO homeassistant.setup:setup.py:144 Setting up http
  252. INFO homeassistant.setup:setup.py:184 Setup of domain http took 0.0 seconds.
  253. DEBUG homeassistant.core:core.py:574 Bus:Handling <Event component_loaded[L]: component=http>
  254. INFO homeassistant.loader:loader.py:212 Loaded plex from homeassistant.components.plex
  255. DEBUG homeassistant.core:core.py:574 Bus:Handling <Event data_entry_flow_progressed[L]: handler=plex, flow_id=afbf054635b04988ae5c70c0e8738c06, refresh=True>
  256. ERROR homeassistant.components.plex:config_flow.py:103 Unknown error connecting to Plex server: 'MockConnections' object has no attribute 'connect'
  257. --------------------------- Captured stderr teardown ---------------------------
  258. DEBUG:homeassistant.core:Bus:Handling <Event homeassistant_stop[L]>
  259. ERROR:homeassistant.core:Error doing job: Task exception was never retrieved
  260. Traceback (most recent call last):
  261. File "/Users/paulus/dev/hass/home-assistant/homeassistant/core.py", line 1208, in async_call
  262. raise ServiceNotFound(domain, service) from None
  263. homeassistant.exceptions.ServiceNotFound: Unable to find service persistent_notification/dismiss
  264. DEBUG:homeassistant.core:Bus:Handling <Event homeassistant_close[L]>
  265. ---------------------------- Captured log teardown -----------------------------
  266. DEBUG homeassistant.core:core.py:574 Bus:Handling <Event homeassistant_stop[L]>
  267. ERROR homeassistant.core:core.py:145 Error doing job: Task exception was never retrieved
  268. Traceback (most recent call last):
  269. File "/Users/paulus/dev/hass/home-assistant/homeassistant/core.py", line 1208, in async_call
  270. raise ServiceNotFound(domain, service) from None
  271. homeassistant.exceptions.ServiceNotFound: Unable to find service persistent_notification/dismiss
  272. DEBUG homeassistant.core:core.py:574 Bus:Handling <Event homeassistant_close[L]>
  273. _________________ test_adding_last_unconfigured_server[pyloop] _________________
  274.  
  275. hass = <homeassistant.core.HomeAssistant object at 0x11c480e50>
  276.  
  277. async def test_adding_last_unconfigured_server(hass):
  278. """Test automatically adding last unconfigured server when multiple servers on account."""
  279.  
  280. await async_setup_component(hass, "http", {"http": {}})
  281.  
  282. MockConfigEntry(
  283. domain=config_flow.DOMAIN,
  284. data={
  285. config_flow.CONF_SERVER_IDENTIFIER: MOCK_ID_2,
  286. config_flow.CONF_SERVER: MOCK_NAME_2,
  287. },
  288. ).add_to_hass(hass)
  289.  
  290. result = await hass.config_entries.flow.async_init(
  291. config_flow.DOMAIN, context={"source": "user"}
  292. )
  293. assert result["type"] == "form"
  294. assert result["step_id"] == "start_website_auth"
  295.  
  296. mock_connections = MockConnections()
  297. mm_plex_account = MagicMock()
  298. mm_plex_account.resources = Mock(return_value=[MOCK_SERVER_1, MOCK_SERVER_2])
  299. mm_plex_account.resource = Mock(return_value=mock_connections)
  300.  
  301. with patch("plexapi.myplex.MyPlexAccount", return_value=mm_plex_account), patch(
  302. "plexapi.server.PlexServer"
  303. ) as mock_plex_server, asynctest.patch(
  304. "plexauth.PlexAuth.initiate_auth"
  305. ), asynctest.patch(
  306. "plexauth.PlexAuth.token", return_value=MOCK_TOKEN
  307. ):
  308. type(mock_plex_server.return_value).machineIdentifier = PropertyMock(
  309. return_value=MOCK_SERVER_1.clientIdentifier
  310. )
  311. type(mock_plex_server.return_value).friendlyName = PropertyMock(
  312. return_value=MOCK_SERVER_1.name
  313. )
  314. type( # pylint: disable=protected-access
  315. mock_plex_server.return_value
  316. )._baseurl = PropertyMock(return_value=mock_connections.connections[0].httpuri)
  317.  
  318. result = await hass.config_entries.flow.async_configure(result["flow_id"])
  319. assert result["type"] == "external"
  320.  
  321. result = await hass.config_entries.flow.async_configure(result["flow_id"])
  322. assert result["type"] == "external_done"
  323.  
  324. result = await hass.config_entries.flow.async_configure(result["flow_id"])
  325. > assert result["type"] == "create_entry"
  326. E AssertionError: assert 'abort' == 'create_entry'
  327. E - abort
  328. E + create_entry
  329.  
  330. tests/components/plex/test_config_flow.py:424: AssertionError
  331. ---------------------------- Captured stderr setup -----------------------------
  332. DEBUG:asyncio:Using selector: KqueueSelector
  333. ------------------------------ Captured log setup ------------------------------
  334. DEBUG asyncio:selector_events.py:53 Using selector: KqueueSelector
  335. ----------------------------- Captured stderr call -----------------------------
  336. INFO:homeassistant.loader:Loaded test from custom_components.test
  337. INFO:homeassistant.loader:Loaded test_package from custom_components.test_package
  338. INFO:homeassistant.loader:Loaded http from homeassistant.components.http
  339. INFO:homeassistant.setup:Setting up http
  340. INFO:homeassistant.setup:Setup of domain http took 0.0 seconds.
  341. DEBUG:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=http>
  342. INFO:homeassistant.loader:Loaded plex from homeassistant.components.plex
  343. DEBUG:homeassistant.core:Bus:Handling <Event data_entry_flow_progressed[L]: handler=plex, flow_id=92b2f6c2b1df4530a17e7eda632f9d67, refresh=True>
  344. ERROR:homeassistant.components.plex:Unknown error connecting to Plex server: 'MockConnections' object has no attribute 'connect'
  345. ------------------------------ Captured log call -------------------------------
  346. INFO homeassistant.loader:loader.py:212 Loaded test from custom_components.test
  347. INFO homeassistant.loader:loader.py:212 Loaded test_package from custom_components.test_package
  348. INFO homeassistant.loader:loader.py:212 Loaded http from homeassistant.components.http
  349. INFO homeassistant.setup:setup.py:144 Setting up http
  350. INFO homeassistant.setup:setup.py:184 Setup of domain http took 0.0 seconds.
  351. DEBUG homeassistant.core:core.py:574 Bus:Handling <Event component_loaded[L]: component=http>
  352. INFO homeassistant.loader:loader.py:212 Loaded plex from homeassistant.components.plex
  353. DEBUG homeassistant.core:core.py:574 Bus:Handling <Event data_entry_flow_progressed[L]: handler=plex, flow_id=92b2f6c2b1df4530a17e7eda632f9d67, refresh=True>
  354. ERROR homeassistant.components.plex:config_flow.py:103 Unknown error connecting to Plex server: 'MockConnections' object has no attribute 'connect'
  355. --------------------------- Captured stderr teardown ---------------------------
  356. DEBUG:homeassistant.core:Bus:Handling <Event homeassistant_stop[L]>
  357. ERROR:homeassistant.core:Error doing job: Task exception was never retrieved
  358. Traceback (most recent call last):
  359. File "/Users/paulus/dev/hass/home-assistant/homeassistant/core.py", line 1208, in async_call
  360. raise ServiceNotFound(domain, service) from None
  361. homeassistant.exceptions.ServiceNotFound: Unable to find service persistent_notification/dismiss
  362. DEBUG:homeassistant.core:Bus:Handling <Event homeassistant_close[L]>
  363. ---------------------------- Captured log teardown -----------------------------
  364. DEBUG homeassistant.core:core.py:574 Bus:Handling <Event homeassistant_stop[L]>
  365. ERROR homeassistant.core:core.py:145 Error doing job: Task exception was never retrieved
  366. Traceback (most recent call last):
  367. File "/Users/paulus/dev/hass/home-assistant/homeassistant/core.py", line 1208, in async_call
  368. raise ServiceNotFound(domain, service) from None
  369. homeassistant.exceptions.ServiceNotFound: Unable to find service persistent_notification/dismiss
  370. DEBUG homeassistant.core:core.py:574 Bus:Handling <Event homeassistant_close[L]>
  371. ========================= 4 failed, 12 passed in 1.39s =========================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement