various: remove dead code; fix skipped tests
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I9100489be899f9e9fbd32f6aca3080196a6a6964
This commit is contained in:
parent
2f31242442
commit
cfdc3d0622
18 changed files with 1445 additions and 28 deletions
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue