async def test_update_with_json_attrs_not_dict(hass, mqtt_mock, caplog):
    'Test attributes get extracted from a JSON result.'
    assert (await async_setup_component(hass, switch.DOMAIN, {switch.DOMAIN: {'platform': 'mqtt', 'name': 'test', 'command_topic': 'test-topic', 'json_attributes_topic': 'attr-topic'}}))
    async_fire_mqtt_message(hass, 'attr-topic', '[ "list", "of", "things"]')
    (await hass.async_block_till_done())
    state = hass.states.get('switch.test')
    assert (state.attributes.get('val') is None)
    assert ('JSON result was not a dictionary' in caplog.text)
Test attributes get extracted from a JSON result.
async def test_update_with_json_attrs_not_dict(hass, mqtt_mock, caplog):
    
    assert (await async_setup_component(hass, switch.DOMAIN, {switch.DOMAIN: {'platform': 'mqtt', 'name': 'test', 'command_topic': 'test-topic', 'json_attributes_topic': 'attr-topic'}}))
    async_fire_mqtt_message(hass, 'attr-topic', '[ "list", "of", "things"]')
    (await hass.async_block_till_done())
    state = hass.states.get('switch.test')
    assert (state.attributes.get('val') is None)
    assert ('JSON result was not a dictionary' in caplog.text)