fn multiple_logout(mut srv: TestServer) {
    // Log in twice
    let token_1 = common::login(&mut srv, "george");
    let token_2 = common::login(&mut srv, "george");

    let token_1 = match token_1 {
        Some(t) => t,
        None => panic!("Token 1 not found!"),
    };

    let token_2 = match token_2 {
        Some(t) => t,
        None => panic!("Token 1 not found!"),
    };

    // Make sure both tokens are valid by grabbing the profile
    common::profile(&mut srv, Some(&token_1), StatusCode::OK);
    common::profile(&mut srv, Some(&token_2), StatusCode::OK);

    // Now log out token_2, but keep 1 logged in
    common::logout(&mut srv, Some(&token_2), StatusCode::OK);

    // Try to fetch the profiles again, token 2 should failed
    common::profile(&mut srv, Some(&token_1), StatusCode::OK);
    common::profile(&mut srv, Some(&token_2), StatusCode::UNAUTHORIZED);

    // Log out token 1
    common::logout(&mut srv, Some(&token_1), StatusCode::OK);

    // Try to fetch the profiles again, both should failed
    common::profile(&mut srv, Some(&token_1), StatusCode::UNAUTHORIZED);
    common::profile(&mut srv, Some(&token_2), StatusCode::UNAUTHORIZED);
}
/// Test logging out of a client when a user has multiple clients
/// connected (aka multiple entries for userid in table)
Test logging out of a client when a user has multiple clients
connected (aka multiple entries for userid in table)
Test logging out of a client when a user has multiple clients connected ( aka multiple entries for userid in table )
fn multiple_logout(mut srv: TestServer) {
    // Log in twice
    let token_1 = common::login(&mut srv, "george");
    let token_2 = common::login(&mut srv, "george");
    let token_1 = match token_1 {
        Some(t) => t,
        None => panic!("Token 1 not found!"),
    };
    let token_2 = match token_2 {
        Some(t) => t,
        None => panic!("Token 1 not found!"),
    };
    // Make sure both tokens are valid by grabbing the profile
    common::profile(&mut srv, Some(&token_1), StatusCode::OK);
    common::profile(&mut srv, Some(&token_2), StatusCode::OK);
    // Now log out token_2, but keep 1 logged in
    common::logout(&mut srv, Some(&token_2), StatusCode::OK);
    // Try to fetch the profiles again, token 2 should failed
    common::profile(&mut srv, Some(&token_1), StatusCode::OK);
    common::profile(&mut srv, Some(&token_2), StatusCode::UNAUTHORIZED);
    // Log out token 1
    common::logout(&mut srv, Some(&token_1), StatusCode::OK);
    // Try to fetch the profiles again, both should failed
    common::profile(&mut srv, Some(&token_1), StatusCode::UNAUTHORIZED);
    common::profile(&mut srv, Some(&token_2), StatusCode::UNAUTHORIZED);
}
fn multiple_logout ( mut srv : TestServer ) { // Log in twice let token_1 = common :: login ( & mut srv , " " ) ; let token_2 = common :: login ( & mut srv , " " ) ; let token_1 = match token_1 { Some ( t ) => t , None => panic ! ( " " ) , } ; let token_2 = match token_2 { Some ( t ) => t , None => panic ! ( " " ) , } ; // Make sure both tokens are valid by grabbing the profile common :: profile ( & mut srv , Some ( & token_1 ) , StatusCode :: OK ) ; common :: profile ( & mut srv , Some ( & token_2 ) , StatusCode :: OK ) ; // Now log out token_2, but keep 1 logged in common :: logout ( & mut srv , Some ( & token_2 ) , StatusCode :: OK ) ; // Try to fetch the profiles again, token 2 should failed common :: profile ( & mut srv , Some ( & token_1 ) , StatusCode :: OK ) ; common :: profile ( & mut srv , Some ( & token_2 ) , StatusCode :: UNAUTHORIZED ) ; // Log out token 1 common :: logout ( & mut srv , Some ( & token_1 ) , StatusCode :: OK ) ; // Try to fetch the profiles again, both should failed common :: profile ( & mut srv , Some ( & token_1 ) , StatusCode :: UNAUTHORIZED ) ; common :: profile ( & mut srv , Some ( & token_2 ) , StatusCode :: UNAUTHORIZED ) ; }
Test logging out of a client when a user has multiple clients
connected (aka multiple entries for userid in table)
Test logging out of a client when a user has multiple clients connected ( aka multiple entries for userid in table )
srv
TestServer
srv
TestServer