mod common;

use randomorg_rpc::{IntegersParams, SignedExtras};

#[tokio::test]
async fn create_url_and_html() {
    let c = common::client();
    let r = c
        .generate_signed_integers(IntegersParams::new(2, 1, 6), SignedExtras::new())
        .await
        .unwrap();

    let url = c.create_url(&r.random.0, &r.signature).unwrap();
    assert!(
        url.starts_with("https://api.random.org/signatures/form"),
        "url: {url}"
    );
    assert!(url.contains("&signature="));
    assert!(url.len() <= 2046);

    let html = c.create_html(&r.random.0, &r.signature);
    assert!(html.contains("api.random.org/signatures/form"));
    assert!(html.contains("name='random'"));
    assert!(html.contains("name='signature'"));
}
