(token: Token)
| 140 | } |
| 141 | |
| 142 | async fn post_question(token: Token) { |
| 143 | let q = Question { |
| 144 | title: "First Question".to_string(), |
| 145 | content: "How can I test?".to_string(), |
| 146 | }; |
| 147 | |
| 148 | let client = reqwest::Client::new(); |
| 149 | let res = client |
| 150 | .post("http://localhost:3030/questions") |
| 151 | .header("Authorization", token.0) |
| 152 | .json(&q) |
| 153 | .send() |
| 154 | .await |
| 155 | .unwrap() |
| 156 | .json::<QuestionAnswer>() |
| 157 | .await |
| 158 | .unwrap(); |
| 159 | |
| 160 | assert_eq!(res.id, 1); |
| 161 | assert_eq!(res.title, q.title); |
| 162 | } |