···11-mod actor_likes;
22-mod author_feed;
33-mod custom_feed;
44-mod post_thread;
55-mod timeline;
66-77-pub use actor_likes::get_actor_likes;
88-pub use author_feed::get_author_feed;
99-pub use custom_feed::get_feed;
1010-pub use post_thread::get_post_thread;
1111-pub use timeline::get_timeline;
···11pub mod actor;
22pub mod admin;
33pub mod error;
44-pub mod feed;
54pub mod identity;
65pub mod moderation;
77-pub mod notification;
86pub mod notification_prefs;
97pub mod proxy;
108pub mod proxy_client;
1111-pub mod read_after_write;
129pub mod repo;
1310pub mod server;
1411pub mod temp;
-3
src/api/notification/mod.rs
···11-mod register_push;
22-33-pub use register_push::register_push;
···170170 let pool = get_pool().await;
171171 let (token, did) = create_account_and_login(&client).await;
172172173173+ let unique_email = format!("newemail_{}@example.com", uuid::Uuid::new_v4());
173174 let prefs = json!({
174174- "email": "newemail@example.com"
175175+ "email": unique_email
175176 });
176177 let resp = client
177178 .post(format!("{}/xrpc/com.bspds.account.updateNotificationPrefs", base))
···217218 .await
218219 .unwrap();
219220 let body: Value = resp.json().await.unwrap();
220220- assert_eq!(body["email"], "newemail@example.com");
221221+ assert_eq!(body["email"], unique_email);
221222}
+3-2
tests/admin_search.rs
···1212 let (user_did, _) = setup_new_user("search-target").await;
1313 let res = client
1414 .get(format!(
1515- "{}/xrpc/com.atproto.admin.searchAccounts",
1515+ "{}/xrpc/com.atproto.admin.searchAccounts?limit=1000",
1616 base_url().await
1717 ))
1818 .bearer_auth(&admin_jwt)
···2424 let accounts = body["accounts"].as_array().expect("accounts should be array");
2525 assert!(!accounts.is_empty(), "Should return some accounts");
2626 let found = accounts.iter().any(|a| a["did"].as_str() == Some(&user_did));
2727- assert!(found, "Should find the created user in results");
2727+ assert!(found, "Should find the created user in results (DID: {})", user_did);
2828}
29293030#[tokio::test]
···111111#[tokio::test]
112112async fn test_search_accounts_requires_admin() {
113113 let client = client();
114114+ let _ = create_account_and_login(&client).await;
114115 let (_, user_jwt) = setup_new_user("search-nonadmin").await;
115116 let res = client
116117 .get(format!(
-135
tests/appview_integration.rs
···11-mod common;
22-33-use common::{base_url, client, create_account_and_login};
44-use reqwest::StatusCode;
55-use serde_json::{Value, json};
66-77-#[tokio::test]
88-async fn test_get_author_feed_returns_appview_data() {
99- let client = client();
1010- let base = base_url().await;
1111- let (jwt, did) = create_account_and_login(&client).await;
1212- let res = client
1313- .get(format!(
1414- "{}/xrpc/app.bsky.feed.getAuthorFeed?actor={}",
1515- base, did
1616- ))
1717- .header("Authorization", format!("Bearer {}", jwt))
1818- .send()
1919- .await
2020- .unwrap();
2121- assert_eq!(res.status(), StatusCode::OK);
2222- let body: Value = res.json().await.unwrap();
2323- assert!(body["feed"].is_array(), "Response should have feed array");
2424- let feed = body["feed"].as_array().unwrap();
2525- assert_eq!(feed.len(), 1, "Feed should have 1 post from appview");
2626- assert_eq!(
2727- feed[0]["post"]["record"]["text"].as_str(),
2828- Some("Author feed post from appview"),
2929- "Post text should match appview response"
3030- );
3131-}
3232-3333-#[tokio::test]
3434-async fn test_get_actor_likes_returns_appview_data() {
3535- let client = client();
3636- let base = base_url().await;
3737- let (jwt, did) = create_account_and_login(&client).await;
3838- let res = client
3939- .get(format!(
4040- "{}/xrpc/app.bsky.feed.getActorLikes?actor={}",
4141- base, did
4242- ))
4343- .header("Authorization", format!("Bearer {}", jwt))
4444- .send()
4545- .await
4646- .unwrap();
4747- assert_eq!(res.status(), StatusCode::OK);
4848- let body: Value = res.json().await.unwrap();
4949- assert!(body["feed"].is_array(), "Response should have feed array");
5050- let feed = body["feed"].as_array().unwrap();
5151- assert_eq!(feed.len(), 1, "Feed should have 1 liked post from appview");
5252- assert_eq!(
5353- feed[0]["post"]["record"]["text"].as_str(),
5454- Some("Liked post from appview"),
5555- "Post text should match appview response"
5656- );
5757-}
5858-5959-#[tokio::test]
6060-async fn test_get_post_thread_returns_appview_data() {
6161- let client = client();
6262- let base = base_url().await;
6363- let (jwt, did) = create_account_and_login(&client).await;
6464- let res = client
6565- .get(format!(
6666- "{}/xrpc/app.bsky.feed.getPostThread?uri=at://{}/app.bsky.feed.post/test123",
6767- base, did
6868- ))
6969- .header("Authorization", format!("Bearer {}", jwt))
7070- .send()
7171- .await
7272- .unwrap();
7373- assert_eq!(res.status(), StatusCode::OK);
7474- let body: Value = res.json().await.unwrap();
7575- assert!(
7676- body["thread"].is_object(),
7777- "Response should have thread object"
7878- );
7979- assert_eq!(
8080- body["thread"]["$type"].as_str(),
8181- Some("app.bsky.feed.defs#threadViewPost"),
8282- "Thread should be a threadViewPost"
8383- );
8484- assert_eq!(
8585- body["thread"]["post"]["record"]["text"].as_str(),
8686- Some("Thread post from appview"),
8787- "Post text should match appview response"
8888- );
8989-}
9090-9191-#[tokio::test]
9292-async fn test_get_feed_returns_appview_data() {
9393- let client = client();
9494- let base = base_url().await;
9595- let (jwt, _did) = create_account_and_login(&client).await;
9696- let res = client
9797- .get(format!(
9898- "{}/xrpc/app.bsky.feed.getFeed?feed=at://did:plc:test/app.bsky.feed.generator/test",
9999- base
100100- ))
101101- .header("Authorization", format!("Bearer {}", jwt))
102102- .send()
103103- .await
104104- .unwrap();
105105- assert_eq!(res.status(), StatusCode::OK);
106106- let body: Value = res.json().await.unwrap();
107107- assert!(body["feed"].is_array(), "Response should have feed array");
108108- let feed = body["feed"].as_array().unwrap();
109109- assert_eq!(feed.len(), 1, "Feed should have 1 post from appview");
110110- assert_eq!(
111111- feed[0]["post"]["record"]["text"].as_str(),
112112- Some("Custom feed post from appview"),
113113- "Post text should match appview response"
114114- );
115115-}
116116-117117-#[tokio::test]
118118-async fn test_register_push_proxies_to_appview() {
119119- let client = client();
120120- let base = base_url().await;
121121- let (jwt, _did) = create_account_and_login(&client).await;
122122- let res = client
123123- .post(format!("{}/xrpc/app.bsky.notification.registerPush", base))
124124- .header("Authorization", format!("Bearer {}", jwt))
125125- .json(&json!({
126126- "serviceDid": "did:web:example.com",
127127- "token": "test-push-token",
128128- "platform": "ios",
129129- "appId": "xyz.bsky.app"
130130- }))
131131- .send()
132132- .await
133133- .unwrap();
134134- assert_eq!(res.status(), StatusCode::OK);
135135-}