]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
python:tests: Use now() instead of utcnow()
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Mon, 2 Oct 2023 00:58:00 +0000 (13:58 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 13 Oct 2023 03:50:31 +0000 (03:50 +0000)
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>
python/samba/tests/gpo.py

index 744c348302aedd523293e6ad9348e252184abe43..c317bd8d15e4cfab98352ffb2f0fe8d0595f8a7f 100644 (file)
@@ -72,7 +72,7 @@ from cryptography.hazmat.primitives import hashes
 from cryptography.hazmat.backends import default_backend
 from cryptography.hazmat.primitives.asymmetric import rsa
 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
 
 def dummy_certificate():
@@ -81,7 +81,7 @@ def dummy_certificate():
                            os.environ.get('SERVER'))
     ])
     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,
                                    backend=default_backend())