Skip to content

Commit

Permalink
Add missing parse collect job id test to router tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mendess committed Oct 3, 2024
1 parent 5a7c46f commit 24255a4
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion crates/daphne-server/src/router/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ mod test {
};
use daphne::{
async_test_versions,
messages::{AggregationJobId, Base64Encode, TaskId},
messages::{AggregationJobId, Base64Encode, CollectionJobId, TaskId},
DapError, DapRequest, DapResource, DapSender, DapVersion,
};
use daphne_service_utils::{
Expand Down Expand Up @@ -630,6 +630,33 @@ mod test {

async_test_versions! { parse_agg_job_id }

async fn parse_collect_job_id(version: DapVersion) {
let test = test_router();

let task_id = mk_task_id();
let collect_job_id = CollectionJobId(thread_rng().gen());

let req = test(
Request::builder()
.uri(format!(
"/{version}/{}/{}/parse-collect-job-id",
task_id.to_base64url(),
collect_job_id.to_base64url(),
))
.header(CONTENT_TYPE, "application/dap-collect-req")
.header(http_headers::DAP_AUTH_TOKEN, BEARER_TOKEN)
.body(Body::empty())
.unwrap(),
)
.await
.unwrap();

assert_eq!(req.resource, DapResource::CollectionJob(collect_job_id));
assert_eq!(req.task_id.unwrap(), task_id);
}

async_test_versions! { parse_collect_job_id }

async fn incorrect_bearer_tokens_are_rejected(version: DapVersion) {
let test = test_router();

Expand Down

0 comments on commit 24255a4

Please sign in to comment.