test(gpodder): implement full test suite

* these tests were partially generated using AI, and reviewed by me
* there are 4 failing tests related to subscription counts; this is
  known functionality that still needs to be implemented
This commit is contained in:
Jef Roosens 2026-05-06 21:43:48 +02:00
parent 8498fe9661
commit c2e0c4d091
Signed by: Jef Roosens
GPG key ID: 21FD3D77D56BAF49
11 changed files with 1813 additions and 4 deletions

View file

@ -277,4 +277,64 @@ mod tests {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::auth::test_remove_old_sessions(store);
}
#[test]
fn test_get_unknown_session() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::auth::test_get_unknown_session(store);
}
#[test]
fn test_session_user_agent_stored() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::auth::test_session_user_agent_stored(store);
}
#[test]
fn test_update_user() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::auth::test_update_user(store);
}
#[test]
fn test_remove_user() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::auth::test_remove_user(store);
}
#[test]
fn test_paginated_users() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::auth::test_paginated_users(store);
}
#[test]
fn test_paginated_users_filter() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::auth::test_paginated_users_filter(store);
}
#[test]
fn test_paginated_sessions() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::auth::test_paginated_sessions(store);
}
#[test]
fn test_insert_and_get_signup_link() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::auth::test_insert_and_get_signup_link(store);
}
#[test]
fn test_get_unknown_signup_link() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::auth::test_get_unknown_signup_link(store);
}
#[test]
fn test_remove_signup_link() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::auth::test_remove_signup_link(store);
}
}

View file

@ -307,4 +307,46 @@ mod tests {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::device::test_insert_devices(store);
}
#[test]
fn test_device_isolation() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::device::test_device_isolation(store);
}
#[test]
fn test_sync_groups() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::device::test_sync_groups(store);
}
#[test]
fn test_update_existing_device() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::device::test_update_existing_device(store);
}
#[test]
fn test_merge_overlapping_sync_groups() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::device::test_merge_overlapping_sync_groups(store);
}
#[test]
fn test_remove_from_sync_group() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::device::test_remove_from_sync_group(store);
}
#[test]
fn test_synchronize_sync_group_subscriptions() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::device::test_synchronize_sync_group_subscriptions(store);
}
#[test]
fn test_subscription_count_in_device() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::device::test_subscription_count_in_device(store);
}
}

View file

@ -174,3 +174,56 @@ impl gpodder::GpodderEpisodeActionStore for SqliteRepository {
.map_err(AuthErr::from)
}
}
#[cfg(test)]
mod tests {
use crate::SqliteRepository;
#[test]
fn test_add_and_retrieve_episode_actions() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::episode_action::test_add_and_retrieve_episode_actions(store);
}
#[test]
fn test_episode_actions_since_filter() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::episode_action::test_episode_actions_since_filter(store);
}
#[test]
fn test_episode_actions_podcast_filter() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::episode_action::test_episode_actions_podcast_filter(store);
}
#[test]
fn test_episode_actions_device_filter() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::episode_action::test_episode_actions_device_filter(store);
}
#[test]
fn test_episode_actions_play_positions() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::episode_action::test_episode_actions_play_positions(store);
}
#[test]
fn test_episode_actions_aggregated() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::episode_action::test_episode_actions_aggregated(store);
}
#[test]
fn test_episode_actions_isolation_between_users() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::episode_action::test_episode_actions_isolation_between_users(store);
}
#[test]
fn test_add_episode_actions_time_changed() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::episode_action::test_add_episode_actions_time_changed(store);
}
}

View file

@ -372,3 +372,68 @@ impl gpodder::GpodderSubscriptionStore for SqliteRepository {
.map_err(AuthErr::from)
}
}
#[cfg(test)]
mod tests {
use crate::SqliteRepository;
#[test]
fn test_set_subscriptions_for_device() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::subscription::test_set_subscriptions_for_device(store);
}
#[test]
fn test_set_subscriptions_replaces() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::subscription::test_set_subscriptions_replaces(store);
}
#[test]
fn test_update_subscriptions_add() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::subscription::test_update_subscriptions_add(store);
}
#[test]
fn test_update_subscriptions_remove() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::subscription::test_update_subscriptions_remove(store);
}
#[test]
fn test_update_subscriptions_add_and_remove() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::subscription::test_update_subscriptions_add_and_remove(store);
}
#[test]
fn test_subscriptions_for_user() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::subscription::test_subscriptions_for_user(store);
}
#[test]
fn test_subscription_updates_since() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::subscription::test_subscription_updates_since(store);
}
#[test]
fn test_subscription_updates_add_and_remove() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::subscription::test_subscription_updates_add_and_remove(store);
}
#[test]
fn test_subscription_propagation_in_sync_group() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::subscription::test_subscription_propagation_in_sync_group(store);
}
#[test]
fn test_subscription_isolation_between_users() {
let store = SqliteRepository::in_memory().unwrap();
gpodder_test::subscription::test_subscription_isolation_between_users(store);
}
}