this repo has no description
1mod common;
2use common::{base_url, client, create_account_and_login};
3use serde_json::json;
4
5#[tokio::test]
6async fn test_get_timeline_requires_auth() {
7 let client = client();
8 let base = base_url().await;
9 let res = client
10 .get(format!("{}/xrpc/app.bsky.feed.getTimeline", base))
11 .send()
12 .await
13 .unwrap();
14 assert_eq!(res.status(), 401);
15}
16
17#[tokio::test]
18async fn test_get_author_feed_requires_actor() {
19 let client = client();
20 let base = base_url().await;
21 let (jwt, _did) = create_account_and_login(&client).await;
22 let res = client
23 .get(format!("{}/xrpc/app.bsky.feed.getAuthorFeed", base))
24 .header("Authorization", format!("Bearer {}", jwt))
25 .send()
26 .await
27 .unwrap();
28 assert_eq!(res.status(), 400);
29}
30
31#[tokio::test]
32async fn test_get_actor_likes_requires_actor() {
33 let client = client();
34 let base = base_url().await;
35 let (jwt, _did) = create_account_and_login(&client).await;
36 let res = client
37 .get(format!("{}/xrpc/app.bsky.feed.getActorLikes", base))
38 .header("Authorization", format!("Bearer {}", jwt))
39 .send()
40 .await
41 .unwrap();
42 assert_eq!(res.status(), 400);
43}
44
45#[tokio::test]
46async fn test_get_post_thread_requires_uri() {
47 let client = client();
48 let base = base_url().await;
49 let (jwt, _did) = create_account_and_login(&client).await;
50 let res = client
51 .get(format!("{}/xrpc/app.bsky.feed.getPostThread", base))
52 .header("Authorization", format!("Bearer {}", jwt))
53 .send()
54 .await
55 .unwrap();
56 assert_eq!(res.status(), 400);
57}
58
59#[tokio::test]
60async fn test_get_feed_requires_auth() {
61 let client = client();
62 let base = base_url().await;
63 let res = client
64 .get(format!(
65 "{}/xrpc/app.bsky.feed.getFeed?feed=at://did:plc:test/app.bsky.feed.generator/test",
66 base
67 ))
68 .send()
69 .await
70 .unwrap();
71 assert_eq!(res.status(), 401);
72}
73
74#[tokio::test]
75async fn test_get_feed_requires_feed_param() {
76 let client = client();
77 let base = base_url().await;
78 let (jwt, _did) = create_account_and_login(&client).await;
79 let res = client
80 .get(format!("{}/xrpc/app.bsky.feed.getFeed", base))
81 .header("Authorization", format!("Bearer {}", jwt))
82 .send()
83 .await
84 .unwrap();
85 assert_eq!(res.status(), 400);
86}
87
88#[tokio::test]
89async fn test_register_push_requires_auth() {
90 let client = client();
91 let base = base_url().await;
92 let res = client
93 .post(format!(
94 "{}/xrpc/app.bsky.notification.registerPush",
95 base
96 ))
97 .json(&json!({
98 "serviceDid": "did:web:example.com",
99 "token": "test-token",
100 "platform": "ios",
101 "appId": "xyz.bsky.app"
102 }))
103 .send()
104 .await
105 .unwrap();
106 assert_eq!(res.status(), 401);
107}