| 1 |
import os |
| 2 |
from calendar import timegm |
| 3 |
from datetime import datetime, timezone |
| 4 |
|
| 5 |
import pytest |
| 6 |
|
| 7 |
from jwt.algorithms import has_crypto |
| 8 |
|
| 9 |
|
| 10 |
def utc_timestamp() -> int: |
| 11 |
return timegm(datetime.now(tz=timezone.utc).utctimetuple()) |
| 12 |
|
| 13 |
|
| 14 |
def key_path(key_name: str) -> str: |
| 15 |
return os.path.join(os.path.dirname(os.path.realpath(__file__)), "keys", key_name) |
| 16 |
|
| 17 |
|
| 18 |
no_crypto_required = pytest.mark.skipif( |
| 19 |
has_crypto, |
| 20 |
reason="Requires cryptography library not installed", |
| 21 |
) |
| 22 |
|
| 23 |
|
| 24 |
crypto_required = pytest.mark.skipif( |
| 25 |
not has_crypto, |
| 26 |
reason="Requires cryptography library installed", |
| 27 |
) |