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