test_permissions.py 756 B

12345678910111213141516171819202122
  1. from django.shortcuts import reverse
  2. from glitchtip.test_utils.test_case import APIPermissionTestCase
  3. class ChunkUploadAPIPermissionTests(APIPermissionTestCase):
  4. def setUp(self):
  5. self.create_user_org()
  6. self.set_client_credentials(self.auth_token.token)
  7. self.url = reverse(
  8. "chunk-upload", kwargs={"organization_slug": self.organization}
  9. )
  10. def test_get(self):
  11. self.assertGetReqStatusCode(self.url, 403)
  12. self.auth_token.add_permission("project:read")
  13. self.assertGetReqStatusCode(self.url, 200)
  14. def test_post(self):
  15. self.assertGetReqStatusCode(self.url, 403)
  16. self.auth_token.add_permission("project:write")
  17. self.assertGetReqStatusCode(self.url, 200)