-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tests): use
datetime.datetime.now()
in GCP `kms_key_rotation_en…
…abled` (#5976)
- Loading branch information
1 parent
add2134
commit 17c31c6
Showing
1 changed file
with
29 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import datetime | ||
from unittest import mock | ||
|
||
from tests.providers.gcp.gcp_fixtures import ( | ||
|
@@ -239,7 +240,10 @@ def test_kms_key_no_rotation_period_and_big_next_rotation_time(self): | |
project_id=GCP_PROJECT_ID, | ||
key_ring=keyring.name, | ||
location=keylocation.name, | ||
next_rotation_time="2025-09-01T00:00:00Z", | ||
# Next rotation time of now + 100 days | ||
next_rotation_time=( | ||
datetime.datetime.now() - datetime.timedelta(days=+100) | ||
).strftime("%Y-%m-%dT%H:%M:%S.%fZ"), | ||
members=["user:[email protected]"], | ||
) | ||
] | ||
|
@@ -296,7 +300,10 @@ def test_kms_key_no_rotation_period_and_appropriate_next_rotation_time(self): | |
project_id=GCP_PROJECT_ID, | ||
key_ring=keyring.name, | ||
location=keylocation.name, | ||
next_rotation_time="2024-09-01T00:00:00Z", | ||
# Next rotation time of now + 30 days | ||
next_rotation_time=( | ||
datetime.datetime.now() - datetime.timedelta(days=+30) | ||
).strftime("%Y-%m-%dT%H:%M:%S.%fZ"), | ||
members=["user:[email protected]"], | ||
) | ||
] | ||
|
@@ -352,7 +359,10 @@ def test_kms_key_rotation_period_greater_90_days_and_big_next_rotation_time(self | |
id="projects/123/locations/us-central1/keyRings/keyring1/cryptoKeys/key1", | ||
project_id=GCP_PROJECT_ID, | ||
rotation_period="8776000s", | ||
next_rotation_time="2025-09-01T00:00:00Z", | ||
# Next rotation time of now + 100 days | ||
next_rotation_time=( | ||
datetime.datetime.now() - datetime.timedelta(days=+100) | ||
).strftime("%Y-%m-%dT%H:%M:%S.%fZ"), | ||
key_ring=keyring.name, | ||
location=keylocation.name, | ||
members=["user:[email protected]"], | ||
|
@@ -412,7 +422,10 @@ def test_kms_key_rotation_period_greater_90_days_and_appropriate_next_rotation_t | |
id="projects/123/locations/us-central1/keyRings/keyring1/cryptoKeys/key1", | ||
project_id=GCP_PROJECT_ID, | ||
rotation_period="8776000s", | ||
next_rotation_time="2024-09-01T00:00:00Z", | ||
# Next rotation time of now + 30 days | ||
next_rotation_time=( | ||
datetime.datetime.now() - datetime.timedelta(days=+30) | ||
).strftime("%Y-%m-%dT%H:%M:%S.%fZ"), | ||
key_ring=keyring.name, | ||
location=keylocation.name, | ||
members=["user:[email protected]"], | ||
|
@@ -470,7 +483,10 @@ def test_kms_key_rotation_period_less_90_days_and_big_next_rotation_time(self): | |
id="projects/123/locations/us-central1/keyRings/keyring1/cryptoKeys/key1", | ||
project_id=GCP_PROJECT_ID, | ||
rotation_period="7776000s", | ||
next_rotation_time="2025-09-01T00:00:00Z", | ||
# Next rotation time of now + 100 days | ||
next_rotation_time=( | ||
datetime.datetime.now() - datetime.timedelta(days=+100) | ||
).strftime("%Y-%m-%dT%H:%M:%S.%fZ"), | ||
key_ring=keyring.name, | ||
location=keylocation.name, | ||
members=["user:[email protected]"], | ||
|
@@ -530,7 +546,10 @@ def test_kms_key_rotation_period_less_90_days_and_appropriate_next_rotation_time | |
id="projects/123/locations/us-central1/keyRings/keyring1/cryptoKeys/key1", | ||
project_id=GCP_PROJECT_ID, | ||
rotation_period="7776000s", | ||
next_rotation_time="2024-09-01T00:00:00Z", | ||
# Next rotation time of now + 30 days | ||
next_rotation_time=( | ||
datetime.datetime.now() - datetime.timedelta(days=+30) | ||
).strftime("%Y-%m-%dT%H:%M:%S.%fZ"), | ||
key_ring=keyring.name, | ||
location=keylocation.name, | ||
members=["user:[email protected]"], | ||
|
@@ -588,7 +607,10 @@ def test_kms_key_rotation_with_fractional_seconds(self): | |
id="projects/123/locations/us-central1/keyRings/keyring1/cryptoKeys/key1", | ||
project_id=GCP_PROJECT_ID, | ||
rotation_period="7776000s", | ||
next_rotation_time="2025-07-06T22:00:00.561275Z", | ||
# Next rotation time of now + 100 days | ||
next_rotation_time=( | ||
datetime.datetime.now() - datetime.timedelta(days=+100) | ||
).strftime("%Y-%m-%dT%H:%M:%S.%fZ"), | ||
key_ring=keyring.name, | ||
location=keylocation.name, | ||
members=["user:[email protected]"], | ||
|