forked from pool/python-softlayer-zeep
77 lines
2.4 KiB
Diff
77 lines
2.4 KiB
Diff
|
---
|
||
|
pyproject.toml | 3 ++-
|
||
|
tests/test_cache.py | 4 ++++
|
||
|
tests/test_wsse_username.py | 3 +++
|
||
|
3 files changed, 9 insertions(+), 1 deletion(-)
|
||
|
|
||
|
--- a/pyproject.toml
|
||
|
+++ b/pyproject.toml
|
||
|
@@ -28,5 +28,6 @@ testpaths = [
|
||
|
]
|
||
|
markers = [
|
||
|
# mark a test to allow socket usage
|
||
|
- "requests"
|
||
|
+ "requests",
|
||
|
+ "network: test case requires network connection",
|
||
|
]
|
||
|
--- a/tests/test_cache.py
|
||
|
+++ b/tests/test_cache.py
|
||
|
@@ -35,6 +35,7 @@ class TestSqliteCache:
|
||
|
result = c.get("http://tests.python-zeep.org/example.wsdl")
|
||
|
assert result is None
|
||
|
|
||
|
+ @pytest.mark.network
|
||
|
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")
|
||
|
@@ -51,6 +52,7 @@ class TestSqliteCache:
|
||
|
assert result == b"content"
|
||
|
|
||
|
|
||
|
+@pytest.mark.network
|
||
|
def test_memory_cache_timeout(tmpdir):
|
||
|
c = cache.InMemoryCache()
|
||
|
c.add("http://tests.python-zeep.org/example.wsdl", b"content")
|
||
|
@@ -76,6 +78,7 @@ class TestIsExpired:
|
||
|
def test_timeout_none(self):
|
||
|
assert cache._is_expired(100, None) is False
|
||
|
|
||
|
+ @pytest.mark.network
|
||
|
def test_has_expired(self):
|
||
|
timeout = 7200
|
||
|
utcnow = datetime.datetime.utcnow()
|
||
|
@@ -83,6 +86,7 @@ class TestIsExpired:
|
||
|
with freezegun.freeze_time(utcnow):
|
||
|
assert cache._is_expired(value, timeout) is False
|
||
|
|
||
|
+ @pytest.mark.network
|
||
|
def test_has_not_expired(self):
|
||
|
timeout = 7200
|
||
|
utcnow = datetime.datetime.utcnow()
|
||
|
--- a/tests/test_wsse_username.py
|
||
|
+++ b/tests/test_wsse_username.py
|
||
|
@@ -85,6 +85,7 @@ def test_password_text():
|
||
|
assert_nodes_equal(envelope, expected)
|
||
|
|
||
|
|
||
|
+@pytest.mark.network
|
||
|
@freeze_time("2016-05-08 12:00:00")
|
||
|
def test_password_digest(monkeypatch):
|
||
|
monkeypatch.setattr(os, "urandom", lambda x: b"mocked-random")
|
||
|
@@ -138,6 +139,7 @@ def test_password_digest(monkeypatch):
|
||
|
assert_nodes_equal(envelope, expected)
|
||
|
|
||
|
|
||
|
+@pytest.mark.network
|
||
|
@freeze_time("2016-05-08 12:00:00")
|
||
|
def test_password_digest_custom(monkeypatch):
|
||
|
monkeypatch.setattr(os, "urandom", lambda x: b"mocked-random")
|
||
|
@@ -323,6 +325,7 @@ def test_timestamp_token():
|
||
|
assert_nodes_equal(envelope, expected)
|
||
|
|
||
|
|
||
|
+@pytest.mark.network
|
||
|
@freeze_time("2016-05-08 12:00:00")
|
||
|
def test_bytes_like_password_digest(monkeypatch):
|
||
|
monkeypatch.setattr(os, "urandom", lambda x: b"mocked-random")
|