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.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566use http::StatusCode;use serde_json::json;
use crate::common::{Client, get_server};
mod common;
#[tokio::test]async fn add_subscription() { let server = get_server().await; let client = Client::new(&server);
let response = client .add_web_push_subscription(json!( { "endpoint": "https://updates.push.services.mozilla.com/wpush/v1/...", "keys": { "p256dh": "key_from_browser_as_base64", "auth": "auth_from_browser_as_base64" } })) .await;
response.assert_status_success(); response.assert_json(&json!( { "endpoint": "https://updates.push.services.mozilla.com/wpush/v1/...", "keys": { "p256dh": "key_from_browser_as_base64", "auth": "auth_from_browser_as_base64" } }));}
#[tokio::test]async fn handle_duplicated_subscription() { let server = get_server().await; let client = Client::new(&server);
let response = client .add_web_push_subscription(json!( { "endpoint": "https://updates.push.services.mozilla.com/wpush/v1/...", "keys": { "p256dh": "key_from_browser_as_base64", "auth": "auth_from_browser_as_base64" } })) .await;
response.assert_status_success();
let response = client .add_web_push_subscription(json!( { "endpoint": "https://updates.push.services.mozilla.com/wpush/v1/...", "keys": { "p256dh": "key_from_browser_as_base64", "auth": "auth_from_browser_as_base64" } })) .await;
response.assert_status(StatusCode::NOT_MODIFIED);}