-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Sonarr config flow to standardize ports #127625
Changes from 4 commits
ab020ba
d108ef1
30768fb
33410c9
0e71a11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,34 @@ async def test_cannot_connect( | |
assert result["errors"] == {"base": "cannot_connect"} | ||
|
||
|
||
async def test_url_rewrite( | ||
hass: HomeAssistant, | ||
mock_sonarr_config_flow: MagicMock, | ||
mock_setup_entry: None, | ||
) -> None: | ||
"""Test the full manual user flow from start to finish.""" | ||
result = await hass.config_entries.flow.async_init( | ||
DOMAIN, | ||
context={CONF_SOURCE: SOURCE_USER}, | ||
) | ||
|
||
assert result["type"] is FlowResultType.FORM | ||
assert result["step_id"] == "user" | ||
|
||
user_input = MOCK_USER_INPUT.copy() | ||
user_input[CONF_URL] = "https://192.168.1.189" | ||
result = await hass.config_entries.flow.async_configure( | ||
result["flow_id"], | ||
user_input=user_input, | ||
) | ||
|
||
assert result["type"] is FlowResultType.CREATE_ENTRY | ||
assert result["title"] == "192.168.1.189" | ||
|
||
assert result["data"] | ||
assert result["data"][CONF_URL] == "https://192.168.1.189:443/" | ||
Comment on lines
+53
to
+78
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we parametrize this test and just throw a lot of scenarios to it so we are sure this keeps working like we expect? (We have seen some YARL issues in the last. weeks, so it would be useful to avoid regressions) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did notice when I added this to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the mean time, this is already an improvement, so let's move forward with this one at least. |
||
|
||
|
||
async def test_invalid_auth( | ||
hass: HomeAssistant, mock_sonarr_config_flow: MagicMock | ||
) -> None: | ||
|
@@ -145,7 +173,7 @@ async def test_full_user_flow_implementation( | |
assert result["title"] == "192.168.1.189" | ||
|
||
assert result["data"] | ||
assert result["data"][CONF_URL] == "http://192.168.1.189:8989" | ||
assert result["data"][CONF_URL] == "http://192.168.1.189:8989/" | ||
|
||
|
||
async def test_full_user_flow_advanced_options( | ||
|
@@ -175,7 +203,7 @@ async def test_full_user_flow_advanced_options( | |
assert result["title"] == "192.168.1.189" | ||
|
||
assert result["data"] | ||
assert result["data"][CONF_URL] == "http://192.168.1.189:8989" | ||
assert result["data"][CONF_URL] == "http://192.168.1.189:8989/" | ||
assert result["data"][CONF_VERIFY_SSL] | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the extra slash?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My assumption is that at least a few users will probably have this proxied behind some kind of service an may have to have a path component, if no path is specified then yarl just does a
/
in place of it.reference: https://github.com/home-assistant/core/pull/127625/files#diff-e4368ac4899b15f980f4e784edaa60285fd6f7b04847463d414d86e17f4a2e87R105