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.
Rust
at rust-backend
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364use http::StatusCode;use serde_json::json;
use crate::common::client::get_client;
mod common;
#[tokio::test]async fn add_subscription() { let client = get_client().await;
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 client = get_client().await;
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);}