test_permissions.py 741 B

1234567891011121314151617181920
  1. from django.urls import reverse
  2. from glitchtip.test_utils.test_case import APIPermissionTestCase
  3. from .test_api import generate_file
  4. class ChunkUploadAPIPermissionTests(APIPermissionTestCase):
  5. def setUp(self):
  6. self.create_user_org()
  7. self.set_client_credentials(self.auth_token.token)
  8. self.url = reverse("api:chunk_upload", args=[self.organization])
  9. def test_post(self):
  10. data = {"file_gzip": generate_file()}
  11. res = self.client.post(self.url, data, **self.get_headers())
  12. self.assertEqual(res.status_code, 403)
  13. self.auth_token.add_permission("project:write")
  14. res = self.client.post(self.url, data, **self.get_headers())
  15. self.assertEqual(res.status_code, 200)