tests.py 743 B

123456789101112131415161718
  1. from django.shortcuts import reverse
  2. from rest_framework.test import APITestCase
  3. from model_bakery import baker
  4. from glitchtip import test_utils # pylint: disable=unused-import
  5. class OrganizationsAPITestCase(APITestCase):
  6. def setUp(self):
  7. self.user = baker.make("users.user")
  8. self.organization = baker.make("organizations.Organization")
  9. self.client.force_login(self.user)
  10. def test_organizations_retrieve(self):
  11. project = baker.make("projects.Project", organization=self.organization)
  12. url = reverse("organization-detail", args=[self.organization.slug])
  13. res = self.client.get(url)
  14. self.assertContains(res, self.organization.name)
  15. self.assertContains(res, project.name)