1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

python:tests: Use now() instead of utcnow()

utcnow() is deprecated and will be removed in a future version of Python.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton 2023-10-02 13:58:00 +13:00 committed by Andrew Bartlett
parent af61444d7a
commit f7009e2a35

View File

@ -72,7 +72,7 @@ from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.backends import default_backend from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import rsa from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives.serialization import Encoding from cryptography.hazmat.primitives.serialization import Encoding
from datetime import datetime, timedelta from datetime import datetime, timedelta, timezone
from samba.samba3 import param as s3param from samba.samba3 import param as s3param
def dummy_certificate(): def dummy_certificate():
@ -81,7 +81,7 @@ def dummy_certificate():
os.environ.get('SERVER')) os.environ.get('SERVER'))
]) ])
cons = x509.BasicConstraints(ca=True, path_length=0) cons = x509.BasicConstraints(ca=True, path_length=0)
now = datetime.utcnow() now = datetime.now(tz=timezone.utc)
key = rsa.generate_private_key(public_exponent=65537, key_size=2048, key = rsa.generate_private_key(public_exponent=65537, key_size=2048,
backend=default_backend()) backend=default_backend())