mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +01:00
update tests
This commit is contained in:
parent
1baead993a
commit
491d43aa8c
@ -644,6 +644,7 @@ mod tests {
|
||||
use router::Pattern;
|
||||
use resource::Resource;
|
||||
use test::TestRequest;
|
||||
use server::ServerSettings;
|
||||
|
||||
#[test]
|
||||
fn test_debug() {
|
||||
@ -720,7 +721,7 @@ mod tests {
|
||||
resource.name("index");
|
||||
let mut map = HashMap::new();
|
||||
map.insert(Pattern::new("index", "/{key}/"), Some(resource));
|
||||
let (router, _) = Router::new("", map);
|
||||
let (router, _) = Router::new("", ServerSettings::default(), map);
|
||||
assert!(router.recognize(&mut req).is_some());
|
||||
|
||||
assert_eq!(req.match_info().get("key"), Some("value"));
|
||||
@ -822,7 +823,7 @@ mod tests {
|
||||
resource.name("index");
|
||||
let mut map = HashMap::new();
|
||||
map.insert(Pattern::new("index", "/user/{name}.{ext}"), Some(resource));
|
||||
let (router, _) = Router::new("", map);
|
||||
let (router, _) = Router::new("", ServerSettings::default(), map);
|
||||
assert!(router.has_route("/user/test.html"));
|
||||
assert!(!router.has_route("/test/unknown"));
|
||||
|
||||
@ -849,7 +850,7 @@ mod tests {
|
||||
resource.name("index");
|
||||
let mut map = HashMap::new();
|
||||
map.insert(Pattern::new("youtube", "https://youtube.com/watch/{video_id}"), None);
|
||||
let (router, _) = Router::new::<()>("", map);
|
||||
let (router, _) = Router::new::<()>("", ServerSettings::default(), map);
|
||||
assert!(!router.has_route("https://youtube.com/watch/unknown"));
|
||||
|
||||
let req = req.with_state(Rc::new(()), router);
|
||||
|
@ -312,7 +312,7 @@ mod tests {
|
||||
routes.insert(Pattern::new("", "/v{val}/{val2}/index.html"), Some(Resource::default()));
|
||||
routes.insert(Pattern::new("", "/v/{tail:.*}"), Some(Resource::default()));
|
||||
routes.insert(Pattern::new("", "{test}/index.html"), Some(Resource::default()));
|
||||
let (rec, _) = Router::new::<()>("", routes);
|
||||
let (rec, _) = Router::new::<()>("", ServerSettings::default(), routes);
|
||||
|
||||
let mut req = HttpRequest::new(
|
||||
Method::GET, Uri::from_str("/name").unwrap(),
|
||||
|
Loading…
Reference in New Issue
Block a user