44 lines
1.1 KiB
Rust
44 lines
1.1 KiB
Rust
mod common;
|
|
|
|
use gpodder::{DevicePatch, DeviceRepository, DeviceType};
|
|
|
|
#[test]
|
|
fn test_insert_devices() {
|
|
let (path, store, users) = common::setup();
|
|
|
|
store.devices_for_user(&users[0]).unwrap();
|
|
|
|
store
|
|
.update_device_info(
|
|
&users[0],
|
|
"device1",
|
|
DevicePatch {
|
|
caption: Some("caption1".to_string()),
|
|
r#type: Some(DeviceType::Other),
|
|
},
|
|
)
|
|
.expect("update info shouldn't fail");
|
|
|
|
store
|
|
.update_device_info(
|
|
&users[1],
|
|
"device2",
|
|
DevicePatch {
|
|
caption: Some("caption2".to_string()),
|
|
r#type: Some(DeviceType::Laptop),
|
|
},
|
|
)
|
|
.expect("update info shouldn't fail");
|
|
|
|
let devices = store.devices_for_user(&users[0]);
|
|
assert!(matches!(devices, Ok(_)));
|
|
|
|
let devices = devices.unwrap();
|
|
assert_eq!(devices.len(), 1);
|
|
|
|
assert_eq!(devices[0].caption, "caption1");
|
|
assert_eq!(devices[0].r#type, DeviceType::Other);
|
|
|
|
common::teardown(path);
|
|
}
|