'Test error handling when response has an error status.'

@mock.patch('homeassistant.components.device_tracker.ddwrt._LOGGER.error')
def test_invalid_response(self, mock_error):

    with requests_mock.Mocker() as mock_request:
        mock_request.register_uri('GET', ('http://%s/Status_Wireless.live.asp' % TEST_HOST), status_code=444)
        with assert_setup_component(1, DOMAIN):
            assert setup_component(self.hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: 'ddwrt', CONF_HOST: TEST_HOST, CONF_USERNAME: 'fake_user', CONF_PASSWORD: '0'}})
            self.assertTrue(('Invalid    response    from    DD-WRT' in str(mock_error.call_args_list[(-1)])))
