async fn sequence(client: &Client, class_id: i32) {
    logout(client).await;
    login_user(TEACHER_USERNAME, TEACHER_PASSWORD, client).await;
    let res = client
        .post(format!("/class/{}/task/async/create", class_id))
        .header(ContentType::Form)
        .body(format!(
            "title={}&description={}&due_date={}",
            NEW_TASK_TITLE,
            NEW_TASK_DESCRIPTION,
            (chrono::Utc::now() + chrono::Duration::days(7))
                .naive_utc()
                .format("%Y-%m-%dT%H:%M")
                .to_string()
        ))
        .dispatch()
        .await;
    let string = res.into_string().await.expect("invalid body string");
    assert!(string.contains("created"));
    rocket::tokio::time::sleep(std::time::Duration::from_secs(3)).await;
    let client = DavClient::new_unauthenticated("http://localhost:8080/user/calendars/lovelace");
    let calendar = client.calendar();
    let results = calendar
        .date_search(
            Utc::now() - Duration::days(1),
            Utc::now() + Duration::days(14),
        )
        .await
        .unwrap();
    assert_eq!(results.len(), 1);
}
/// Runs the test sequence (adds a number of events and checks that they are added to the calendar)
Runs the test sequence (adds a number of events and checks that they are added to the calendar)
Runs the test sequence ( adds a number of events and checks that they are added to the calendar )
async fn sequence(client: &Client, class_id: i32) {
    logout(client).await;
    login_user(TEACHER_USERNAME, TEACHER_PASSWORD, client).await;
    let res = client
        .post(format!("/class/{}/task/async/create", class_id))
        .header(ContentType::Form)
        .body(format!(
            "title={}&description={}&due_date={}",
            NEW_TASK_TITLE,
            NEW_TASK_DESCRIPTION,
            (chrono::Utc::now() + chrono::Duration::days(7))
                .naive_utc()
                .format("%Y-%m-%dT%H:%M")
                .to_string()
        ))
        .dispatch()
        .await;
    let string = res.into_string().await.expect("invalid body string");
    assert!(string.contains("created"));
    rocket::tokio::time::sleep(std::time::Duration::from_secs(3)).await;
    let client = DavClient::new_unauthenticated("http://localhost:8080/user/calendars/lovelace");
    let calendar = client.calendar();
    let results = calendar
        .date_search(
            Utc::now() - Duration::days(1),
            Utc::now() + Duration::days(14),
        )
        .await
        .unwrap();
    assert_eq!(results.len(), 1);
}
async fn sequence ( client : & Client , class_id : i32 ) { logout ( client ) . await ; login_user ( TEACHER_USERNAME , TEACHER_PASSWORD , client ) . await ; let res = client . post ( format ! ( " " class_id ) ) . header ( ContentType :: Form ) . body ( format ! ( " " NEW_TASK_TITLE NEW_TASK_DESCRIPTION ( chrono Utc now ( ) chrono Duration days ( 7 ) ) naive_utc ( ) format ( " " ) to_string ( ) ) ) . dispatch ( ) . await ; let string = res . into_string ( ) . await . expect ( " " ) ; assert ! ( string contains ( " " ) ) ; rocket :: tokio :: time :: sleep ( std :: time :: Duration :: from_secs ( 3 ) ) . await ; let client = DavClient :: new_unauthenticated ( " " ) ; let calendar = client . calendar ( ) ; let results = calendar . date_search ( Utc :: now ( ) - Duration :: days ( 1 ) , Utc :: now ( ) + Duration :: days ( 14 ) , ) . await . unwrap ( ) ; assert_eq ! ( results len ( ) 1 ) ; }
Runs the test sequence (adds a number of events and checks that they are added to the calendar)
Runs the test sequence ( adds a number of events and checks that they are added to the calendar )
client
&Client
class_id
i32