httpmock patterns are too general (#467)
This commit is contained in:
parent
87749a11ee
commit
b94123e5ac
|
@ -70,7 +70,7 @@ impl PathTemplate {
|
||||||
.iter()
|
.iter()
|
||||||
.map(|c| match c {
|
.map(|c| match c {
|
||||||
Component::Constant(name) => name.clone(),
|
Component::Constant(name) => name.clone(),
|
||||||
Component::Parameter(_) => ".*".to_string(),
|
Component::Parameter(_) => "[^/]*".to_string(),
|
||||||
})
|
})
|
||||||
.collect::<String>();
|
.collect::<String>();
|
||||||
format!("^{}$", inner)
|
format!("^{}$", inner)
|
||||||
|
|
|
@ -75,7 +75,7 @@ pub mod operations {
|
||||||
Self(
|
Self(
|
||||||
inner
|
inner
|
||||||
.method(httpmock::Method::GET)
|
.method(httpmock::Method::GET)
|
||||||
.path_matches(regex::Regex::new("^/v1/task/.*$").unwrap()),
|
.path_matches(regex::Regex::new("^/v1/task/[^/]*$").unwrap()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ pub mod operations {
|
||||||
Self(
|
Self(
|
||||||
inner
|
inner
|
||||||
.method(httpmock::Method::GET)
|
.method(httpmock::Method::GET)
|
||||||
.path_matches(regex::Regex::new("^/v1/tasks/.*/events$").unwrap()),
|
.path_matches(regex::Regex::new("^/v1/tasks/[^/]*/events$").unwrap()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ pub mod operations {
|
||||||
Self(
|
Self(
|
||||||
inner
|
inner
|
||||||
.method(httpmock::Method::GET)
|
.method(httpmock::Method::GET)
|
||||||
.path_matches(regex::Regex::new("^/v1/tasks/.*/outputs$").unwrap()),
|
.path_matches(regex::Regex::new("^/v1/tasks/[^/]*/outputs$").unwrap()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ pub mod operations {
|
||||||
Self(
|
Self(
|
||||||
inner
|
inner
|
||||||
.method(httpmock::Method::GET)
|
.method(httpmock::Method::GET)
|
||||||
.path_matches(regex::Regex::new("^/v1/tasks/.*/outputs/.*$").unwrap()),
|
.path_matches(regex::Regex::new("^/v1/tasks/[^/]*/outputs/[^/]*$").unwrap()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,7 +471,7 @@ pub mod operations {
|
||||||
Self(
|
Self(
|
||||||
inner
|
inner
|
||||||
.method(httpmock::Method::POST)
|
.method(httpmock::Method::POST)
|
||||||
.path_matches(regex::Regex::new("^/v1/worker/task/.*/append$").unwrap()),
|
.path_matches(regex::Regex::new("^/v1/worker/task/[^/]*/append$").unwrap()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -511,7 +511,7 @@ pub mod operations {
|
||||||
Self(
|
Self(
|
||||||
inner
|
inner
|
||||||
.method(httpmock::Method::POST)
|
.method(httpmock::Method::POST)
|
||||||
.path_matches(regex::Regex::new("^/v1/worker/task/.*/chunk$").unwrap()),
|
.path_matches(regex::Regex::new("^/v1/worker/task/[^/]*/chunk$").unwrap()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,7 +556,7 @@ pub mod operations {
|
||||||
Self(
|
Self(
|
||||||
inner
|
inner
|
||||||
.method(httpmock::Method::POST)
|
.method(httpmock::Method::POST)
|
||||||
.path_matches(regex::Regex::new("^/v1/worker/task/.*/complete$").unwrap()),
|
.path_matches(regex::Regex::new("^/v1/worker/task/[^/]*/complete$").unwrap()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,7 +597,7 @@ pub mod operations {
|
||||||
Self(
|
Self(
|
||||||
inner
|
inner
|
||||||
.method(httpmock::Method::POST)
|
.method(httpmock::Method::POST)
|
||||||
.path_matches(regex::Regex::new("^/v1/worker/task/.*/output$").unwrap()),
|
.path_matches(regex::Regex::new("^/v1/worker/task/[^/]*/output$").unwrap()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -122,9 +122,9 @@ pub mod operations {
|
||||||
impl InstanceIssueCrucibleSnapshotRequestWhen {
|
impl InstanceIssueCrucibleSnapshotRequestWhen {
|
||||||
pub fn new(inner: httpmock::When) -> Self {
|
pub fn new(inner: httpmock::When) -> Self {
|
||||||
Self(
|
Self(
|
||||||
inner
|
inner.method(httpmock::Method::POST).path_matches(
|
||||||
.method(httpmock::Method::POST)
|
regex::Regex::new("^/instance/disk/[^/]*/snapshot/[^/]*$").unwrap(),
|
||||||
.path_matches(regex::Regex::new("^/instance/disk/.*/snapshot/.*$").unwrap()),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue