async def test_reauth_flow_update_configuration(hass, aioclient_mock):
    'Verify reauth flow can update controller configuration.'
    controller = (await setup_unifi_integration(hass))
    result = (await hass.config_entries.flow.async_init(UNIFI_DOMAIN, context={'source': SOURCE_REAUTH}, data=controller.config_entry))
    assert (result['type'] == data_entry_flow.RESULT_TYPE_FORM)
    assert (result['step_id'] == SOURCE_USER)
    aioclient_mock.get('https://1.2.3.4:1234', status=302)
    aioclient_mock.post('https://1.2.3.4:1234/api/login', json={'data': 'login successful', 'meta': {'rc': 'ok'}}, headers={'content-type': CONTENT_TYPE_JSON})
    aioclient_mock.get('https://1.2.3.4:1234/api/self/sites', json={'data': [{'desc': 'Site name', 'name': 'site_id', 'role': 'admin'}], 'meta': {'rc': 'ok'}}, headers={'content-type': CONTENT_TYPE_JSON})
    result = (await hass.config_entries.flow.async_configure(result['flow_id'], user_input={CONF_HOST: '1.2.3.4', CONF_USERNAME: 'new_name', CONF_PASSWORD: 'new_pass', CONF_PORT: 1234, CONF_VERIFY_SSL: True}))
    assert (result['type'] == data_entry_flow.RESULT_TYPE_ABORT)
    assert (result['reason'] == 'reauth_successful')
    assert (controller.host == '1.2.3.4')
    assert (controller.config_entry.data[CONF_CONTROLLER][CONF_USERNAME] == 'new_name')
    assert (controller.config_entry.data[CONF_CONTROLLER][CONF_PASSWORD] == 'new_pass')
Verify reauth flow can update controller configuration.
async def test_reauth_flow_update_configuration(hass, aioclient_mock):
    
    controller = (await setup_unifi_integration(hass))
    result = (await hass.config_entries.flow.async_init(UNIFI_DOMAIN, context={'source': SOURCE_REAUTH}, data=controller.config_entry))
    assert (result['type'] == data_entry_flow.RESULT_TYPE_FORM)
    assert (result['step_id'] == SOURCE_USER)
    aioclient_mock.get('https://1.2.3.4:1234', status=302)
    aioclient_mock.post('https://1.2.3.4:1234/api/login', json={'data': 'login successful', 'meta': {'rc': 'ok'}}, headers={'content-type': CONTENT_TYPE_JSON})
    aioclient_mock.get('https://1.2.3.4:1234/api/self/sites', json={'data': [{'desc': 'Site name', 'name': 'site_id', 'role': 'admin'}], 'meta': {'rc': 'ok'}}, headers={'content-type': CONTENT_TYPE_JSON})
    result = (await hass.config_entries.flow.async_configure(result['flow_id'], user_input={CONF_HOST: '1.2.3.4', CONF_USERNAME: 'new_name', CONF_PASSWORD: 'new_pass', CONF_PORT: 1234, CONF_VERIFY_SSL: True}))
    assert (result['type'] == data_entry_flow.RESULT_TYPE_ABORT)
    assert (result['reason'] == 'reauth_successful')
    assert (controller.host == '1.2.3.4')
    assert (controller.config_entry.data[CONF_CONTROLLER][CONF_USERNAME] == 'new_name')
    assert (controller.config_entry.data[CONF_CONTROLLER][CONF_PASSWORD] == 'new_pass')