Ejemplo n.º 1
0
 def datetime_normalize(
         cls, v: Union[datetime.datetime,
                       str]) -> Optional[datetime.datetime]:
     if isinstance(v, datetime.datetime):
         return datetime.datetime.fromtimestamp(v.timestamp())
     elif isinstance(v, str):
         return ts_parse(v)
     else:
         return None
Ejemplo n.º 2
0
 def _stale_aa_services(self) -> List[str]:
     thresh = datetime.datetime.now() - datetime.timedelta(
         days=self.config["repo_requirements"]["oldest_aa_data_days"])
     stale_services = []
     if self.aa_data:
         for service in self.aa_data:
             if ts_parse(service["lastUpdated"], ignoretz=True) < thresh:
                 stale_services.append(service["serviceName"])
     return stale_services
Ejemplo n.º 3
0
def test_role_update_refreshed(role_dict):
    r = Role(**role_dict)
    old_refreshed = ts_parse(r.refreshed)
    r._update_refreshed()
    new_refreshed = ts_parse(r.refreshed)
    assert new_refreshed > old_refreshed