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