various: remove dead code; fix skipped tests

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I9100489be899f9e9fbd32f6aca3080196a6a6964
This commit is contained in:
raf 2026-02-05 00:18:02 +03:00
commit cfdc3d0622
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
18 changed files with 1445 additions and 28 deletions

View file

@ -293,7 +293,6 @@ pub struct CreateSavedSearchRequest {
pub sort_order: Option<String>,
}
#[allow(dead_code)]
impl ApiClient {
pub fn new(base_url: &str, api_key: Option<&str>) -> Self {
let mut headers = header::HeaderMap::new();
@ -1124,3 +1123,40 @@ impl ApiClient {
.unwrap_or_else(|_| Client::new());
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_base_url() {
let client = ApiClient::new("http://localhost:3000", None);
assert_eq!(client.base_url(), "http://localhost:3000");
}
#[test]
fn test_stream_url() {
let client = ApiClient::new("http://localhost:3000", None);
let url = client.stream_url("test-id-123");
assert_eq!(url, "http://localhost:3000/api/v1/media/test-id-123/stream");
}
#[test]
fn test_thumbnail_url() {
let client = ApiClient::new("http://localhost:3000", None);
let url = client.thumbnail_url("test-id-456");
assert_eq!(url, "http://localhost:3000/api/v1/media/test-id-456/thumbnail");
}
#[test]
fn test_client_creation_with_api_key() {
let client = ApiClient::new("http://localhost:3000", Some("test-key"));
assert_eq!(client.base_url(), "http://localhost:3000");
}
#[test]
fn test_base_url_trailing_slash() {
let client = ApiClient::new("http://localhost:3000/", None);
assert_eq!(client.base_url(), "http://localhost:3000");
}
}