mirror of
https://github.com/RaisFast/raisfast.git
synced 2026-09-24 08:02:36 +00:00
32 lines
1009 B
Rust
32 lines
1009 B
Rust
use super::*;
|
|
|
|
#[tokio::test]
|
|
async fn feed_empty() {
|
|
let (mut app, _) = test_app().await;
|
|
let (status, bytes) = send_raw(&mut app, get_req("/feed.xml")).await;
|
|
assert!(status.is_success());
|
|
let body = String::from_utf8(bytes).unwrap();
|
|
assert!(body.contains("<rss"));
|
|
assert!(body.contains("</rss>"));
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn feed_with_posts() {
|
|
let (mut app, state) = test_app().await;
|
|
let (int_id, doc_id) = create_author(&state.pool).await;
|
|
let tok = make_token(&doc_id, int_id, raisfast::models::user::UserRole::Author);
|
|
let _: (StatusCode, Value) = send(
|
|
&mut app,
|
|
post_json_auth(
|
|
"/api/v1/posts",
|
|
json!({"title": "RSS Post", "content": "content", "status": "published"}),
|
|
&tok,
|
|
),
|
|
)
|
|
.await;
|
|
let (status, bytes) = send_raw(&mut app, get_req("/feed.xml")).await;
|
|
assert!(status.is_success());
|
|
let body = String::from_utf8(bytes).unwrap();
|
|
assert!(body.contains("RSS Post"));
|
|
}
|