artifactize-provider 0.27.2

Managed credentials, model discovery and direct HTTP turns for Artifactize.
Documentation
use super::*;

#[test]
fn integer_seconds_keep_the_entire_saved_domain() {
    for seconds in [0, 1, 10_000, u64::MAX] {
        let wire = seconds.to_string();
        let time: Timestamp = serde_json::from_str(&wire).unwrap();
        assert_eq!(time.seconds(), seconds);
        assert_eq!(serde_json::to_string(&time).unwrap(), wire);
    }
    for wire in ["-1", "1.5", "\"100\"", "null"] {
        assert!(serde_json::from_str::<Timestamp>(wire).is_err());
    }
}

#[test]
fn timestamp_margins_preserve_checked_and_saturating_overflow() {
    let time = Timestamp::from_seconds(10_000);
    assert_eq!(
        time.checked_add(Duration::from_secs(3600))
            .unwrap()
            .seconds(),
        13_600
    );
    let last = Timestamp::from_seconds(u64::MAX);
    assert!(last.checked_add(Duration::from_secs(1)).is_none());
    assert_eq!(last.saturating_add(Duration::from_secs(300)), last);
}