diff --git a/pybis/src/python/tests/test_openbis.py b/pybis/src/python/tests/test_openbis.py
index 1155cb2f147fb976f7f85ba79dc16c9ea8566ca7..4ead70bc1d713777686c7122e5ee5e7d0333e176 100644
--- a/pybis/src/python/tests/test_openbis.py
+++ b/pybis/src/python/tests/test_openbis.py
@@ -16,29 +16,28 @@ def test_token(openbis_instance):
 
 def test_http_only(openbis_instance):
     with pytest.raises(Exception):
-        new_instance = Openbis('http://localhost')
+        new_instance = Openbis("http://localhost")
         assert new_instance is None
 
-    new_instance = Openbis(url='http://localhost', allow_http_but_do_not_use_this_in_production_and_only_within_safe_networks=True)
+    new_instance = Openbis(
+        url="http://localhost",
+        allow_http_but_do_not_use_this_in_production_and_only_within_safe_networks=True,
+    )
     assert new_instance is not None
 
 
-def test_cached_token(openbis_instance):
-    openbis_instance.save_token()
-    assert openbis_instance.token_path is not None
-    assert openbis_instance._get_cached_token() is not None
+def test_cached_token(other_openbis_instance):
+    assert other_openbis_instance.token_path is not None
+    assert other_openbis_instance.is_token_valid() is True
 
-    another_instance = Openbis(openbis_instance.url, verify_certificates=openbis_instance.verify_certificates)
-    assert another_instance.is_token_valid() is True
-
-    openbis_instance.delete_token()
-    assert openbis_instance._get_cached_token() is None
+    other_openbis_instance.logout()
+    assert other_openbis_instance.is_token_valid() is False
 
 
 def test_create_permId(openbis_instance):
     permId = openbis_instance.create_permId()
     assert permId is not None
-    m = re.search('([0-9]){17}-([0-9]*)', permId)
+    m = re.search("([0-9]){17}-([0-9]*)", permId)
     ts = m.group(0)
     assert ts is not None
     count = m.group(1)