🐛 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 functionmain
parent
fa070ea7d0
commit
0a46fc05dc
|
@ -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),
|
||||||
] {
|
] {
|
||||||
|
|
Loading…
Reference in New Issue