Something went wrong. Try again.
A simple to-do app focused on tasks that can be completed within a specific time span. taskline.tobinio.dev
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465use serde_json::json;use uuid::Uuid;
use crate::common::{Client, get_server};
mod common;
#[tokio::test]async fn failes_without_login() { let server = get_server().await; let client = Client::new_no_user(&server);
let response = client.get_todos().await; response.assert_status_unauthorized();}
#[tokio::test]async fn works_with_org() { let server = get_server().await; let mut client = Client::new(&server);
let org_uuid = Uuid::new_v4(); client .add_organization_json(json!({ "uuid": org_uuid, "name": "Test Organization", })) .await;
client.set_org(org_uuid);
let response = client.get_todos().await; response.assert_status_success();}
#[tokio::test]async fn failes_for_unknown_org() { let server = get_server().await; let client = Client::new_with_org(&server, Uuid::new_v4());
let response = client.get_todos().await; response.assert_status_unauthorized();}
#[tokio::test]async fn failes_for_not_joined_org() { let server = get_server().await;
let user1_client = Client::new(&server); let org_uuid = Uuid::new_v4(); let add_org_response = user1_client .add_organization(json!({ "uuid": org_uuid, "name": "Test Organization", })) .await; add_org_response.assert_status_success();
// User 2 tries to access the organization without joining let user2_client = Client::new_with_org(&server, org_uuid);
let response = user2_client.get_todos().await; response.assert_status_unauthorized();}