Skip to content

Commit 9ffbf58

Browse files
committed
test file change
1 parent 0fc618e commit 9ffbf58

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/test_03_key_bundle.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import shutil
55
import time
6+
from pathlib import Path
67

78
import pytest
89
import requests
@@ -493,6 +494,23 @@ def test_local_jwk():
493494
assert kb
494495

495496

497+
def test_local_jwk_update():
498+
cache_time = 0.1
499+
_path = full_path('jwk_private_key.json')
500+
kb = KeyBundle(source='file://{}'.format(_path), cache_time=cache_time)
501+
assert kb
502+
_ = kb.keys()
503+
last1 = kb.last_local
504+
_ = kb.keys()
505+
last2 = kb.last_local
506+
assert last1 == last2 # file not changed
507+
time.sleep(cache_time + 0.1)
508+
Path(_path).touch()
509+
_ = kb.keys()
510+
last3 = kb.last_local
511+
assert last2 != last3 # file changed
512+
513+
496514
def test_local_jwk_copy():
497515
_path = full_path('jwk_private_key.json')
498516
kb = KeyBundle(source='file://{}'.format(_path))

0 commit comments

Comments
 (0)