Verified Commit 1643f0cc authored by Mattia Rizzolo's avatar Mattia Rizzolo
Browse files

keyring/tests: mock the time to have a stable output over time.



Thanks to enrico for the patch

Signed-off-by: Mattia Rizzolo's avatarMattia Rizzolo <mattia@debian.org>
parent 70ef0a48
Pipeline #251429 passed with stage
in 5 minutes and 22 seconds
......@@ -140,7 +140,8 @@ class TestKeycheck(TestCase):
test_fpr = "1793D6AB75663E6BF104953A634F4BD1E7AD5568"
kmodels.Key.objects.test_preload(test_fpr)
c = Client()
response = c.get(reverse("keyring_keycheck", kwargs={"fpr": test_fpr}))
with mock.patch("time.time", return_value=1590962400):
response = c.get(reverse("keyring_keycheck", kwargs={"fpr": test_fpr}))
self.assertEqual(response.status_code, 200)
decoded = response.json()
self.assertEqual(decoded["fpr"], test_fpr)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment