2023-01-11 18:50:46 +01:00
use meili_snap ::* ;
use crate ::common ::Server ;
#[ actix_rt::test ]
async fn task_bad_uids ( ) {
let server = Server ::new ( ) . await ;
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . tasks_filter ( " uids=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `uids`: could not parse `doggo` as a positive integer " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_uids " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_uids "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . cancel_tasks ( " uids=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `uids`: could not parse `doggo` as a positive integer " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_uids " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_uids "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . delete_tasks ( " uids=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `uids`: could not parse `doggo` as a positive integer " ,
" code " : " invalid_task_uids " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_uids "
2023-01-12 13:55:53 +01:00
}
" ###);
let ( response , code ) = server . delete_tasks ( " uids=1,dogo " ) . await ;
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-16 16:59:26 +01:00
" message " : " Invalid value in parameter `uids[1]`: could not parse `dogo` as a positive integer " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_uids " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_uids "
2023-01-11 18:50:46 +01:00
}
" ###);
}
#[ actix_rt::test ]
async fn task_bad_canceled_by ( ) {
let server = Server ::new ( ) . await ;
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . tasks_filter ( " canceledBy=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `canceledBy`: could not parse `doggo` as a positive integer " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_canceled_by " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_canceled_by "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . cancel_tasks ( " canceledBy=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `canceledBy`: could not parse `doggo` as a positive integer " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_canceled_by " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_canceled_by "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . delete_tasks ( " canceledBy=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `canceledBy`: could not parse `doggo` as a positive integer " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_canceled_by " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_canceled_by "
2023-01-11 18:50:46 +01:00
}
" ###);
}
#[ actix_rt::test ]
async fn task_bad_types ( ) {
let server = Server ::new ( ) . await ;
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . tasks_filter ( " types=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-05-30 15:18:52 +02:00
" message " : " Invalid value in parameter `types`: `doggo` is not a valid task type. Available types are `documentAdditionOrUpdate`, `documentDeletion`, `settingsUpdate`, `indexCreation`, `indexDeletion`, `indexUpdate`, `indexSwap`, `taskCancelation`, `taskDeletion`, `dumpCreation`, `snapshotCreation`. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_types " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_types "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . cancel_tasks ( " types=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-05-30 15:18:52 +02:00
" message " : " Invalid value in parameter `types`: `doggo` is not a valid task type. Available types are `documentAdditionOrUpdate`, `documentDeletion`, `settingsUpdate`, `indexCreation`, `indexDeletion`, `indexUpdate`, `indexSwap`, `taskCancelation`, `taskDeletion`, `dumpCreation`, `snapshotCreation`. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_types " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_types "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . delete_tasks ( " types=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-05-30 15:18:52 +02:00
" message " : " Invalid value in parameter `types`: `doggo` is not a valid task type. Available types are `documentAdditionOrUpdate`, `documentDeletion`, `settingsUpdate`, `indexCreation`, `indexDeletion`, `indexUpdate`, `indexSwap`, `taskCancelation`, `taskDeletion`, `dumpCreation`, `snapshotCreation`. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_types " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_types "
2023-01-11 18:50:46 +01:00
}
" ###);
}
#[ actix_rt::test ]
async fn task_bad_statuses ( ) {
let server = Server ::new ( ) . await ;
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . tasks_filter ( " statuses=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `statuses`: `doggo` is not a valid task status. Available statuses are `enqueued`, `processing`, `succeeded`, `failed`, `canceled`. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_statuses " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_statuses "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . cancel_tasks ( " statuses=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `statuses`: `doggo` is not a valid task status. Available statuses are `enqueued`, `processing`, `succeeded`, `failed`, `canceled`. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_statuses " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_statuses "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . delete_tasks ( " statuses=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `statuses`: `doggo` is not a valid task status. Available statuses are `enqueued`, `processing`, `succeeded`, `failed`, `canceled`. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_statuses " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_statuses "
2023-01-11 18:50:46 +01:00
}
" ###);
}
#[ actix_rt::test ]
async fn task_bad_index_uids ( ) {
let server = Server ::new ( ) . await ;
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . tasks_filter ( " indexUids=the%20good%20doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `indexUids`: `the good doggo` is not a valid index uid. Index uid can be an integer or a string containing only alphanumeric characters, hyphens (-) and underscores (_). " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_index_uid " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_index_uid "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . cancel_tasks ( " indexUids=the%20good%20doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `indexUids`: `the good doggo` is not a valid index uid. Index uid can be an integer or a string containing only alphanumeric characters, hyphens (-) and underscores (_). " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_index_uid " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_index_uid "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . delete_tasks ( " indexUids=the%20good%20doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `indexUids`: `the good doggo` is not a valid index uid. Index uid can be an integer or a string containing only alphanumeric characters, hyphens (-) and underscores (_). " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_index_uid " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_index_uid "
2023-01-11 18:50:46 +01:00
}
" ###);
}
#[ actix_rt::test ]
async fn task_bad_limit ( ) {
let server = Server ::new ( ) . await ;
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . tasks_filter ( " limit=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `limit`: could not parse `doggo` as a positive integer " ,
2023-01-11 20:33:07 +01:00
" code " : " invalid_task_limit " ,
2023-01-11 18:50:46 +01:00
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_limit "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . cancel_tasks ( " limit=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Unknown parameter `limit`: expected one of `uids`, `canceledBy`, `types`, `statuses`, `indexUids`, `afterEnqueuedAt`, `beforeEnqueuedAt`, `afterStartedAt`, `beforeStartedAt`, `afterFinishedAt`, `beforeFinishedAt` " ,
2023-01-11 18:50:46 +01:00
" code " : " bad_request " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#bad_request "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . delete_tasks ( " limit=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Unknown parameter `limit`: expected one of `uids`, `canceledBy`, `types`, `statuses`, `indexUids`, `afterEnqueuedAt`, `beforeEnqueuedAt`, `afterStartedAt`, `beforeStartedAt`, `afterFinishedAt`, `beforeFinishedAt` " ,
2023-01-11 18:50:46 +01:00
" code " : " bad_request " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#bad_request "
2023-01-11 18:50:46 +01:00
}
" ###);
}
#[ actix_rt::test ]
async fn task_bad_from ( ) {
let server = Server ::new ( ) . await ;
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . tasks_filter ( " from=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `from`: could not parse `doggo` as a positive integer " ,
2023-01-11 20:33:07 +01:00
" code " : " invalid_task_from " ,
2023-01-11 18:50:46 +01:00
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_from "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . cancel_tasks ( " from=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Unknown parameter `from`: expected one of `uids`, `canceledBy`, `types`, `statuses`, `indexUids`, `afterEnqueuedAt`, `beforeEnqueuedAt`, `afterStartedAt`, `beforeStartedAt`, `afterFinishedAt`, `beforeFinishedAt` " ,
2023-01-11 18:50:46 +01:00
" code " : " bad_request " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#bad_request "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . delete_tasks ( " from=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Unknown parameter `from`: expected one of `uids`, `canceledBy`, `types`, `statuses`, `indexUids`, `afterEnqueuedAt`, `beforeEnqueuedAt`, `afterStartedAt`, `beforeStartedAt`, `afterFinishedAt`, `beforeFinishedAt` " ,
2023-01-11 18:50:46 +01:00
" code " : " bad_request " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#bad_request "
2023-01-11 18:50:46 +01:00
}
" ###);
}
#[ actix_rt::test ]
async fn task_bad_after_enqueued_at ( ) {
let server = Server ::new ( ) . await ;
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . tasks_filter ( " afterEnqueuedAt=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `afterEnqueuedAt`: `doggo` is an invalid date-time. It should follow the YYYY-MM-DD or RFC 3339 date-time format. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_after_enqueued_at " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_after_enqueued_at "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . cancel_tasks ( " afterEnqueuedAt=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `afterEnqueuedAt`: `doggo` is an invalid date-time. It should follow the YYYY-MM-DD or RFC 3339 date-time format. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_after_enqueued_at " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https ://docs.meilisearch.com/errors#invalid_task_after_enqueued_at"
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . delete_tasks ( " afterEnqueuedAt=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `afterEnqueuedAt`: `doggo` is an invalid date-time. It should follow the YYYY-MM-DD or RFC 3339 date-time format. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_after_enqueued_at " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_after_enqueued_at "
2023-01-11 18:50:46 +01:00
}
" ###);
}
#[ actix_rt::test ]
async fn task_bad_before_enqueued_at ( ) {
let server = Server ::new ( ) . await ;
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . tasks_filter ( " beforeEnqueuedAt=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `beforeEnqueuedAt`: `doggo` is an invalid date-time. It should follow the YYYY-MM-DD or RFC 3339 date-time format. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_before_enqueued_at " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_before_enqueued_at "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . cancel_tasks ( " beforeEnqueuedAt=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `beforeEnqueuedAt`: `doggo` is an invalid date-time. It should follow the YYYY-MM-DD or RFC 3339 date-time format. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_before_enqueued_at " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_before_enqueued_at "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . delete_tasks ( " beforeEnqueuedAt=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `beforeEnqueuedAt`: `doggo` is an invalid date-time. It should follow the YYYY-MM-DD or RFC 3339 date-time format. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_before_enqueued_at " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_before_enqueued_at "
2023-01-11 18:50:46 +01:00
}
" ###);
}
#[ actix_rt::test ]
async fn task_bad_after_started_at ( ) {
let server = Server ::new ( ) . await ;
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . tasks_filter ( " afterStartedAt=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `afterStartedAt`: `doggo` is an invalid date-time. It should follow the YYYY-MM-DD or RFC 3339 date-time format. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_after_started_at " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_after_started_at "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . cancel_tasks ( " afterStartedAt=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `afterStartedAt`: `doggo` is an invalid date-time. It should follow the YYYY-MM-DD or RFC 3339 date-time format. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_after_started_at " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_after_started_at "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . delete_tasks ( " afterStartedAt=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `afterStartedAt`: `doggo` is an invalid date-time. It should follow the YYYY-MM-DD or RFC 3339 date-time format. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_after_started_at " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_after_started_at "
2023-01-11 18:50:46 +01:00
}
" ###);
}
#[ actix_rt::test ]
async fn task_bad_before_started_at ( ) {
let server = Server ::new ( ) . await ;
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . tasks_filter ( " beforeStartedAt=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `beforeStartedAt`: `doggo` is an invalid date-time. It should follow the YYYY-MM-DD or RFC 3339 date-time format. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_before_started_at " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_before_started_at "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . cancel_tasks ( " beforeStartedAt=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `beforeStartedAt`: `doggo` is an invalid date-time. It should follow the YYYY-MM-DD or RFC 3339 date-time format. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_before_started_at " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_before_started_at "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . delete_tasks ( " beforeStartedAt=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `beforeStartedAt`: `doggo` is an invalid date-time. It should follow the YYYY-MM-DD or RFC 3339 date-time format. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_before_started_at " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_before_started_at "
2023-01-11 18:50:46 +01:00
}
" ###);
}
#[ actix_rt::test ]
async fn task_bad_after_finished_at ( ) {
let server = Server ::new ( ) . await ;
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . tasks_filter ( " afterFinishedAt=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `afterFinishedAt`: `doggo` is an invalid date-time. It should follow the YYYY-MM-DD or RFC 3339 date-time format. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_after_finished_at " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_after_finished_at "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . cancel_tasks ( " afterFinishedAt=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `afterFinishedAt`: `doggo` is an invalid date-time. It should follow the YYYY-MM-DD or RFC 3339 date-time format. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_after_finished_at " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_after_finished_at "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . delete_tasks ( " afterFinishedAt=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `afterFinishedAt`: `doggo` is an invalid date-time. It should follow the YYYY-MM-DD or RFC 3339 date-time format. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_after_finished_at " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_after_finished_at "
2023-01-11 18:50:46 +01:00
}
" ###);
}
#[ actix_rt::test ]
async fn task_bad_before_finished_at ( ) {
let server = Server ::new ( ) . await ;
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . tasks_filter ( " beforeFinishedAt=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `beforeFinishedAt`: `doggo` is an invalid date-time. It should follow the YYYY-MM-DD or RFC 3339 date-time format. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_before_finished_at " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_before_finished_at "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . cancel_tasks ( " beforeFinishedAt=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `beforeFinishedAt`: `doggo` is an invalid date-time. It should follow the YYYY-MM-DD or RFC 3339 date-time format. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_before_finished_at " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_before_finished_at "
2023-01-11 18:50:46 +01:00
}
" ###);
2023-01-12 13:55:53 +01:00
let ( response , code ) = server . delete_tasks ( " beforeFinishedAt=doggo " ) . await ;
2023-01-11 18:50:46 +01:00
snapshot! ( code , @ " 400 Bad Request " ) ;
snapshot! ( json_string! ( response ) , @ r ###"
{
2023-01-12 13:55:53 +01:00
" message " : " Invalid value in parameter `beforeFinishedAt`: `doggo` is an invalid date-time. It should follow the YYYY-MM-DD or RFC 3339 date-time format. " ,
2023-01-11 18:50:46 +01:00
" code " : " invalid_task_before_finished_at " ,
" type " : " invalid_request " ,
2023-01-19 15:48:20 +01:00
" link " : " https://docs.meilisearch.com/errors#invalid_task_before_finished_at "
2023-01-11 18:50:46 +01:00
}
" ###);
}