test_api.py 880 B

1234567891011121314151617181920212223242526
  1. from django.urls import reverse
  2. from model_bakery import baker
  3. from glitchtip.test_utils.test_case import GlitchTestCase
  4. class SourceCodeAPITestCase(GlitchTestCase):
  5. @classmethod
  6. def setUpTestData(cls):
  7. cls.create_user()
  8. def setUp(self):
  9. self.client.force_login(self.user)
  10. def test_assemble(self):
  11. version = "app@v1"
  12. baker.make("releases.Release", version=version, organization=self.organization)
  13. url = reverse("api:artifact_bundle_assemble", args=[self.organization.slug])
  14. data = {
  15. "checksum": "94bc085fe32db9b4b1b82236214d65eeeeeeeeee",
  16. "chunks": ["94bc085fe32db9b4b1b82236214d65eeeeeeeeee"],
  17. "projects": [],
  18. "version": version,
  19. }
  20. res = self.client.post(url, data, content_type="application/json")
  21. self.assertEqual(res.status_code, 200)