def test_cache_default_ttl_can_be_overrided_per_key(): cache = Cache("dummy://null", ttl=600) assert cache.make_ttl(120) == 120
def test_cache_can_be_set_default_ttl(): cache = Cache("dummy://null", ttl=600) assert cache.make_ttl() == 600
def test_cache_can_be_set_default_ttl_in_url(): cache = Cache("dummy://null?ttl=600") assert cache.make_ttl() == 600
def test_cache_errors_if_key_ttl_is_set_to_0(): cache = Cache("dummy://null") with pytest.raises(ValueError): assert cache.make_ttl(0)