'Test for NVR errors.'

@mock.patch.object(uvc, 'UnifiVideoCamera')
@mock.patch('uvcclient.nvr.UVCRemote')
def test_setup_nvr_errors(self, mock_remote, mock_uvc):

    errors = [nvr.NotAuthorized, nvr.NvrError, requests.exceptions.ConnectionError]
    config = {'platform': 'uvc', 'nvr': 'foo', 'key': 'secret'}
    for error in errors:
        mock_remote.return_value.index.side_effect = error
        assert setup_component(self.hass, 'camera', config)
        assert (not mock_uvc.called)
