Skip to content

Commit 6013249

Browse files
committed
tests: Remove unused bad_with_status() function
1 parent 012b72c commit 6013249

File tree

2 files changed

+1
-26
lines changed

2 files changed

+1
-26
lines changed

src/tests/all.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ extern crate serde;
1111
#[macro_use]
1212
extern crate serde_json;
1313

14-
use crate::util::{Bad, RequestHelper, TestApp};
14+
use crate::util::{RequestHelper, TestApp};
1515
use cargo_registry::{
1616
models::{Crate, CrateOwner, Dependency, NewCategory, NewTeam, NewUser, Team, User, Version},
1717
schema::crate_owners,
@@ -182,14 +182,6 @@ fn req(method: conduit::Method, path: &str) -> MockRequest {
182182
request
183183
}
184184

185-
fn bad_resp(r: &mut AppResponse) -> Option<Bad> {
186-
let bad = json::<Bad>(r);
187-
if bad.errors.is_empty() {
188-
return None;
189-
}
190-
Some(bad)
191-
}
192-
193185
fn json<T>(r: &mut AppResponse) -> T
194186
where
195187
for<'de> T: serde::Deserialize<'de>,

src/tests/util.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -554,11 +554,6 @@ pub struct Error {
554554
pub detail: String,
555555
}
556556

557-
#[derive(Deserialize)]
558-
pub struct Bad {
559-
pub errors: Vec<Error>,
560-
}
561-
562557
/// A type providing helper methods for working with responses
563558
#[must_use]
564559
pub struct Response<T> {
@@ -591,18 +586,6 @@ where
591586
crate::json(&mut self.response)
592587
}
593588

594-
/// Assert the response status code and deserialze into a list of errors
595-
///
596-
/// Cargo endpoints return a status 200 on error instead of 400.
597-
#[track_caller]
598-
pub fn bad_with_status(&mut self, expected: StatusCode) -> Bad {
599-
assert_eq!(self.response.status(), expected);
600-
match crate::bad_resp(&mut self.response) {
601-
None => panic!("ok response: {:?}", self.response.status()),
602-
Some(b) => b,
603-
}
604-
}
605-
606589
#[track_caller]
607590
pub fn assert_status(&self, status: StatusCode) -> &Self {
608591
assert_eq!(status, self.response.status());

0 commit comments

Comments
 (0)