Skip to content

Commit

Permalink
Add tests for news metas.
Browse files Browse the repository at this point in the history
  • Loading branch information
terjekv committed Nov 22, 2024
1 parent c5a693a commit 1972d7f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions mreg/api/v1/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,22 @@ def test_meta_version_user_ok(self):
response = self.assert_get("/api/meta/version")
self.assertTrue('version' in response.data)

def test_meta_user_info_self_200_ok(self):
self.client = self.get_token_client(superuser=False)
response = self.assert_get("/api/meta/user")
self.assertTrue('username' in response.data)

def test_meta_user_info_admin_other_target_200_ok(self):
response = self.assert_get("/api/meta/user?username=superuser")
self.assertTrue('username' in response.data)

def test_meta_user_info_user_other_target_403_forbidden(self):
self.client = self.get_token_client(superuser=False)
self.assert_get_and_403("/api/meta/user?username=superuser")

def test_meta_user_info_user_not_found_404_not_found(self):
self.assert_get_and_404("/api/meta/user?username=nonexistent")

def test_meta_heartbeat_user_200_ok(self):
self.client = self.get_token_client(superuser=False)
response = self.assert_get("/api/meta/heartbeat")
Expand Down

0 comments on commit 1972d7f

Please sign in to comment.