예제 #1
0
    def test_has_expired(self, tmpdir):
        c = cache.SqliteCache(path=tmpdir.join("sqlite.cache.db").strpath)
        c.add("http://tests.python-zeep.org/example.wsdl", b"content")

        freeze_dt = datetime.datetime.utcnow() + datetime.timedelta(seconds=7200)
        with freezegun.freeze_time(freeze_dt):
            result = c.get("http://tests.python-zeep.org/example.wsdl")
            assert result is None
예제 #2
0
파일: test_cache.py 프로젝트: Eveler/dmsic
def test_sqlite_cache_timeout(tmpdir):
    c = cache.SqliteCache(path=tmpdir.join('sqlite.cache.db').strpath)
    c.add('http://tests.python-zeep.org/example.wsdl', b'content')
    result = c.get('http://tests.python-zeep.org/example.wsdl')
    assert result == b'content'

    freeze_dt = datetime.datetime.utcnow() + datetime.timedelta(seconds=7200)
    with freezegun.freeze_time(freeze_dt):
        result = c.get('http://tests.python-zeep.org/example.wsdl')
        assert result is None
예제 #3
0
def test_cache_timeout():
    c = cache.SqliteCache(path=':memory:')
    c.add('http://tests.python-zeep.org/example.wsdl', b'content')
    result = c.get('http://tests.python-zeep.org/example.wsdl')
    assert result == b'content'

    freeze_dt = datetime.datetime.utcnow() + datetime.timedelta(seconds=7200)
    with freezegun.freeze_time(freeze_dt):
        result = c.get('http://tests.python-zeep.org/example.wsdl')
        assert result is None
예제 #4
0
파일: test_cache.py 프로젝트: Eveler/dmsic
def test_sqlite_cache(tmpdir):
    c = cache.SqliteCache(path=tmpdir.join('sqlite.cache.db').strpath)
    c.add('http://tests.python-zeep.org/example.wsdl', b'content')

    result = c.get('http://tests.python-zeep.org/example.wsdl')
    assert result == b'content'
def test_sqlite_cache(tmpdir):
    c = cache.SqliteCache(path=tmpdir.join("sqlite.cache.db").strpath)
    c.add("http://tests.python-zeep.org/example.wsdl", b"content")

    result = c.get("http://tests.python-zeep.org/example.wsdl")
    assert result == b"content"
예제 #6
0
def test_custom_cache():
    transport = transports.Transport(cache=cache.SqliteCache())
    assert isinstance(transport.cache, cache.SqliteCache)
예제 #7
0
 def test_no_records(self, tmpdir):
     c = cache.SqliteCache(path=tmpdir.join("sqlite.cache.db").strpath)
     result = c.get("http://tests.python-zeep.org/example.wsdl")
     assert result is None
예제 #8
0
 def test_in_memory(self):
     with pytest.raises(ValueError):
         cache.SqliteCache(path=":memory:")
예제 #9
0
def test_cache():
    c = cache.SqliteCache(path=':memory:')
    c.add('http://tests.python-zeep.org/example.wsdl', b'content')

    result = c.get('http://tests.python-zeep.org/example.wsdl')
    assert result == b'content'