🐛 bug: fix 30-day scraper keys having 7 days of validity.

This won't affect anything, because I had manually written the not_after for
the testing keys. Even the automated tests weren't using the new_30_day
function
main
_ 2020-12-21 14:26:51 +00:00
parent fa070ea7d0
commit 0a46fc05dc
1 changed files with 3 additions and 2 deletions

View File

@ -111,14 +111,14 @@ pub enum KeyValidity {
DurationNegative, DurationNegative,
} }
impl ScraperKey <Valid30Days> { impl <V: MaxValidDuration> ScraperKey <V> {
pub fn new_30_day <S: Into <String>> (name: S, input: &[u8]) -> Self { pub fn new_30_day <S: Into <String>> (name: S, input: &[u8]) -> Self {
let now = Utc::now (); let now = Utc::now ();
Self { Self {
name: name.into (), name: name.into (),
not_before: now, not_before: now,
not_after: now + Duration::days (7), not_after: now + V::dur (),
hash: BlakeHashWrapper::from_key (input), hash: BlakeHashWrapper::from_key (input),
_phantom: Default::default (), _phantom: Default::default (),
} }
@ -227,6 +227,7 @@ mod tests {
for (input, expected) in &[ for (input, expected) in &[
(zero_time + Duration::days (0), ClockIsBehind), (zero_time + Duration::days (0), ClockIsBehind),
(zero_time + Duration::days (2), Valid), (zero_time + Duration::days (2), Valid),
(zero_time + Duration::days (29), Valid),
(zero_time + Duration::days (1 + 30), Expired), (zero_time + Duration::days (1 + 30), Expired),
(zero_time + Duration::days (100), Expired), (zero_time + Duration::days (100), Expired),
] { ] {