0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00
posthog/ee/api/test/base.py
Michael Matloka 96e4ee8512
Nest endpoints of project-based models under /api/project/ – LITE (#2485)
* Nest endpoints under /project/ with StructuredViewSetMixin

* Rewrite URLs

* isort

* Update utils.py

* Fix errors

* Fix almoast all the errors

Last left to do: shared dashboards and permission classes.

* isort

* Adjust for master

* Add compatbility with shared dashboards

* Debug ClickHouse

* Remove some # type: ignores

* Simplify CursorPagination

* Move test base from posthog.api.test to posthog.test

* Improve API structure

* Bring back legacy endpoints

* Fix legacy compatibility

* Fix bugs and typing

* isort

* Fix hooks test

* Try fixing errors

* Fix oversight

* isort

* Fix problems

* isort

* Be more tolerant

* Fix naming and remove redundant code

* Fix imports

* Update deleteWithUndo

* Roll back

* Roll back more

* Update .gitignore

* Rollll back

* Rollllllll

* back

* Betterify

* Address feedback
2020-11-24 23:26:28 +01:00

32 lines
851 B
Python

from typing import Optional
from django.utils import timezone
from ee.models.license import License
from posthog.test.base import APIBaseTest, APITransactionBaseTest
class LicensedTestMixin:
"""
Test API using Django REST Framework test suite, for licensed PostHog (mainly enterprise edition).
"""
CONFIG_LICENSE_PLAN: Optional[str] = "enterprise"
def setUp(self):
super().setUp() # type: ignore
if self.CONFIG_LICENSE_PLAN:
self.license = License.objects._create(
key=self.CONFIG_LICENSE_PLAN,
plan=self.CONFIG_LICENSE_PLAN,
valid_until=timezone.datetime(2038, 1, 19, 3, 14, 7),
)
class APILicensedTest(LicensedTestMixin, APIBaseTest):
pass
class APITransactionLicensedTest(LicensedTestMixin, APITransactionBaseTest):
pass