mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Black
This commit is contained in:
@@ -10,7 +10,7 @@ import requests_mock as rmock
|
||||
@pytest.fixture
|
||||
def registered_flow(hass):
|
||||
"""Mock a registered flow."""
|
||||
local_auth.initialize(hass, 'TEST-CLIENT-ID', 'TEST-CLIENT-SECRET')
|
||||
local_auth.initialize(hass, "TEST-CLIENT-ID", "TEST-CLIENT-SECRET")
|
||||
return hass.data[config_flow.DATA_FLOW_IMPL][const.DOMAIN]
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ async def test_generate_auth_url(registered_flow):
|
||||
|
||||
Mainly testing that it doesn't blow up.
|
||||
"""
|
||||
url = await registered_flow['gen_authorize_url']('TEST-FLOW-ID')
|
||||
url = await registered_flow["gen_authorize_url"]("TEST-FLOW-ID")
|
||||
assert url is not None
|
||||
|
||||
|
||||
@@ -33,19 +33,17 @@ async def test_convert_code(requests_mock, registered_flow):
|
||||
return None
|
||||
|
||||
assert dict(parse_qsl(request.text)) == {
|
||||
'client_id': 'TEST-CLIENT-ID',
|
||||
'client_secret': 'TEST-CLIENT-SECRET',
|
||||
'code': 'TEST-CODE',
|
||||
'grant_type': 'authorization_code'
|
||||
"client_id": "TEST-CLIENT-ID",
|
||||
"client_secret": "TEST-CLIENT-SECRET",
|
||||
"code": "TEST-CODE",
|
||||
"grant_type": "authorization_code",
|
||||
}
|
||||
|
||||
return rmock.create_response(request, json={
|
||||
'access_token': 'TEST-ACCESS-TOKEN'
|
||||
})
|
||||
return rmock.create_response(
|
||||
request, json={"access_token": "TEST-ACCESS-TOKEN"}
|
||||
)
|
||||
|
||||
requests_mock.add_matcher(token_matcher)
|
||||
|
||||
tokens = await registered_flow['convert_code']('TEST-CODE')
|
||||
assert tokens == {
|
||||
'access_token': 'TEST-ACCESS-TOKEN'
|
||||
}
|
||||
tokens = await registered_flow["convert_code"]("TEST-CODE")
|
||||
assert tokens == {"access_token": "TEST-ACCESS-TOKEN"}
|
||||
|
||||
Reference in New Issue
Block a user