def test_login_required(caplog, app_version): client = Client( RAISE_NOTIMPLEMENTEDERROR_FOR_UNIMPLEMENTED_API_ENDPOINTS=True) with caplog.at_level(logging.DEBUG, logger='qbittorrentapi'): qbt_version = client.app.version assert 'Not logged in...attempting login' in caplog.text assert qbt_version == app_version client.auth_log_out() with caplog.at_level(logging.DEBUG, logger='qbittorrentapi'): qbt_version = client.app.version assert 'Not logged in...attempting login' in caplog.text assert qbt_version == app_version
def test_login_required(caplog, app_version): client = Client( RAISE_NOTIMPLEMENTEDERROR_FOR_UNIMPLEMENTED_API_ENDPOINTS=True, VERIFY_WEBUI_CERTIFICATE=False, ) with caplog.at_level(logging.DEBUG, logger="qbittorrentapi"): qbt_version = client.app.version assert "Not logged in...attempting login" in caplog.text assert qbt_version == app_version client.auth_log_out() with caplog.at_level(logging.DEBUG, logger="qbittorrentapi"): qbt_version = client.app.version assert "Not logged in...attempting login" in caplog.text assert qbt_version == app_version
def test_log_in(): client_good = Client(VERIFY_WEBUI_CERTIFICATE=False) client_bad = Client( username="******", password="******", VERIFY_WEBUI_CERTIFICATE=False ) client_good.auth_log_out() assert client_good.auth_log_in() is None assert client_good.is_logged_in is True client_good.auth_log_out() assert client_good.auth.log_in() is None assert client_good.auth.is_logged_in is True assert client_good.auth.is_logged_in is True with pytest.raises(LoginFailed): client_bad.auth_log_in() with pytest.raises(LoginFailed): client_bad.auth.log_in()