refactor into unit

This commit is contained in:
Martin Algesten
2018-06-30 13:05:36 +02:00
parent 0334f9608b
commit f5a4c83819
13 changed files with 349 additions and 297 deletions

View File

@@ -4,9 +4,9 @@ use super::super::*;
#[test]
fn basic_auth() {
test::set_handler("/basic_auth", |req, _url| {
test::set_handler("/basic_auth", |unit| {
assert_eq!(
req.header("Authorization").unwrap(),
unit.header("Authorization").unwrap(),
"Basic bWFydGluOnJ1YmJlcm1hc2hndW0="
);
test::make_response(200, "OK", vec![], vec![])
@@ -19,8 +19,8 @@ fn basic_auth() {
#[test]
fn kind_auth() {
test::set_handler("/kind_auth", |req, _url| {
assert_eq!(req.header("Authorization").unwrap(), "Digest abcdefgh123");
test::set_handler("/kind_auth", |unit| {
assert_eq!(unit.header("Authorization").unwrap(), "Digest abcdefgh123");
test::make_response(200, "OK", vec![], vec![])
});
let resp = get("test://host/kind_auth")