def test_valid(): assert valid("2000-01-12T00:00:00Z") is False current_year = datetime.today().year assert valid("%d-01-12T00:00:00Z" % (current_year + 1)) is True this_instance = instant() assert valid(this_instance) is False # unless on a very fast machine :-) soon = in_a_while(seconds=10) assert valid(soon) is True
def test_instant(): inst = str_to_time(instant()) now = time.gmtime() assert now >= inst
def _expiration(timeout, strformat=None): if timeout == "now": return time_util.instant(strformat) else: # validity time should match lifetime of assertions return time_util.in_a_while(minutes=timeout, format=strformat)
def _expiration(timeout, time_format=None): if timeout == "now": return time_util.instant(time_format) else: # validity time should match lifetime of assertions return time_util.in_a_while(minutes=timeout, time_format=time_format)