Skip to content

Commit

Permalink
tests/mock/tags: refactor assertion and error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
steveej committed Jan 29, 2020
1 parent 69061df commit 712f7da
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/mock/tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ fn test_tags_paginate() {
.build()
.unwrap();

let next = Box::pin(dclient.get_tags(name, Some(1)));
let next = Box::pin(dclient.get_tags(name, Some(1)).map(Result::unwrap));

let (first_tag, stream_rest) = runtime.block_on(next.into_future());
assert_eq!(first_tag.unwrap().unwrap(), "t1".to_owned());
assert_eq!(first_tag.unwrap(), "t1".to_owned());

let (second_tag, stream_rest) = runtime.block_on(stream_rest.into_future());
assert_eq!(second_tag.unwrap().unwrap(), "t2".to_owned());
assert_eq!(second_tag.unwrap(), "t2".to_owned());

let (end, _) = runtime.block_on(stream_rest.into_future());
if end.is_some() {
Expand Down Expand Up @@ -112,7 +112,7 @@ fn test_tags_404() {
let futcheck = dclient.get_tags(name, None);

let res = runtime.block_on(futcheck.collect::<Vec<_>>());
assert!(res.get(0).unwrap().as_ref().is_err());
assert!(res.get(0).unwrap().is_err());

mockito::reset();
}
Expand Down Expand Up @@ -140,8 +140,8 @@ fn test_tags_missing_header() {

let futcheck = dclient.get_tags(name, None);

let res = runtime.block_on(futcheck.collect::<Vec<_>>());
assert!(!res.get(0).unwrap().as_ref().is_err());
let res = runtime.block_on(futcheck.map(Result::unwrap).collect::<Vec<_>>());
assert_eq!(vec!["t1", "t2"], res);

mockito::reset();
}

0 comments on commit 712f7da

Please sign in to comment.