0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 12:21:02 +01:00
posthog/ee/api/test/base.py
Michael Matloka 86c0c1af91
Make Google login an Enterprise/Cloud feature (#2501)
* Make Google login an Enterprise OR Cloud feature

* Fix test

* isort

* Fix typing

* Restore package.json
2020-12-04 19:54:27 +01:00

32 lines
917 B
Python

from typing import Optional, cast
from django.utils import timezone
from ee.models.license import License, LicenseManager
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 = super(LicenseManager, cast(LicenseManager, 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