Skip to content

Commit

Permalink
Fix uptime and meta tests. (#540)
Browse files Browse the repository at this point in the history
  • Loading branch information
terjekv authored May 31, 2024
1 parent c03072c commit bbfcf18
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions mreg/api/v1/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ class APIMetaTestCase(MregAPITestCase):
def test_meta_versions_admin_200_ok(self):
response = self.assert_get_and_200("/api/meta/versions")
for key in ('rest_framework_version', 'django_version', 'python_version'):
self.assertTrue(key in response.data)
print(key, response.data[key])
with self.subTest(key=key):
self.assertTrue(key in response.data)

def test_meta_versions_user_403_forbidden(self):
self.client = self.get_token_client(superuser=False)
Expand All @@ -300,8 +300,8 @@ def test_meta_heartbeat_user_200_ok(self):
self.client = self.get_token_client(superuser=False)
response = self.assert_get("/api/meta/heartbeat")
for key in ('uptime', 'start_time'):
self.assertTrue(key in response.data)
print(key, response.data[key])
with self.subTest(key=key):
self.assertTrue(key in response.data)


class APIAutoupdateZonesTestCase(MregAPITestCase):
Expand Down
2 changes: 1 addition & 1 deletion mreg/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class MetaHeartbeat(APIView):
permission_classes = (IsAuthenticated,)

def get(self, request: Request):
uptime = int(start_time - time.time())
uptime = int(time.time() - start_time)
data = {
"start_time": start_time,
"uptime": uptime,
Expand Down

0 comments on commit bbfcf18

Please sign in to comment.