0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00
posthog/ee/clickhouse/views/test/test_clickhouse_person.py
Tim Glaser 92bd10ffa5
Speed up EE tests by not destroying tables (#5715)
* Speed up EE tests by not destroying tables

* Fix broken tests

* Speed up tests by not running migrations

* Fix last test

* req file?

* caching

* Parallel

* revert exp

* debug without parallel

* Revert "debug without parallel"

This reverts commit 83b3ad633f.

* Undo parallel tests

* Speed up more tests

* use final

* correct final

* print exception

* more prints

* move test

* add filter

* remove duplicate test

* prints here

* test wait

* set variable in query

* remove mutations_sync

* cleanup

Co-authored-by: eric <eeoneric@gmail.com>
2021-08-25 10:58:09 +02:00

29 lines
779 B
Python

from uuid import uuid4
from rest_framework import status
from ee.clickhouse.client import sync_execute
from ee.clickhouse.models.event import create_event
from ee.clickhouse.util import ClickhouseTestMixin
from posthog.api.test.test_person import factory_test_person
from posthog.models import Event, Person
def _create_event(**kwargs):
kwargs.update({"event_uuid": uuid4()})
return Event(pk=create_event(**kwargs))
def _get_events(team_id):
return sync_execute("SELECT * FROM events WHERE team_id = %(team_id)s", {"team_id": team_id})
def _create_person(**kwargs):
return Person.objects.create(**kwargs)
class ClickhouseTestPersonApi(
ClickhouseTestMixin, factory_test_person(_create_event, _create_person, _get_events) # type: ignore
):
pass