예제 #1
0
    def test_delete_events(self):
        create_event(uuid4(), "event1", self.teams[0], "1")
        create_event(uuid4(), "event2", self.teams[1], "2")
        create_event(uuid4(), "event3", self.teams[2], "3")

        delete_teams_data([self.teams[0].pk, self.teams[1].pk])
        self.assertEqual(self.select_remaining("events", "event"), ["event3"])
예제 #2
0
    def test_delete_groups(self):
        create_group(self.teams[0].pk, 0, "g0")
        create_group(self.teams[1].pk, 1, "g1")
        create_group(self.teams[2].pk, 2, "g2")

        delete_teams_data([self.teams[0].pk, self.teams[1].pk])

        self.assertEqual(self.select_remaining("groups", "group_key"), ["g2"])
예제 #3
0
    def test_delete_persons(self):
        uuid0 = create_person(self.teams[0].pk, properties={"x": 0})
        uuid1 = create_person(self.teams[1].pk, properties={"x": 1})
        uuid2 = create_person(self.teams[2].pk, properties={"x": 2})
        create_person_distinct_id(self.teams[0].pk, "0", uuid0)
        create_person_distinct_id(self.teams[1].pk, "1", uuid1)
        create_person_distinct_id(self.teams[2].pk, "2", uuid2)

        delete_teams_data([self.teams[0].pk, self.teams[1].pk])

        self.assertEqual(self.select_remaining("person", "properties"), ['{"x": 2}'])
        self.assertEqual(self.select_remaining("person_distinct_id", "distinct_id"), ["2"])
예제 #4
0
    def test_delete_cohorts(self):
        insert_static_cohort([uuid4()], 0, self.teams[0])
        insert_static_cohort([uuid4()], 1, self.teams[1])
        insert_static_cohort([uuid4()], 2, self.teams[2])

        self._insert_cohortpeople_row(self.teams[0], uuid4(), 3)
        self._insert_cohortpeople_row(self.teams[1], uuid4(), 4)
        self._insert_cohortpeople_row(self.teams[2], uuid4(), 5)

        delete_teams_data([self.teams[0].pk, self.teams[1].pk])

        self.assertEqual(self.select_remaining("person_static_cohort", "cohort_id"), [2])
        self.assertEqual(self.select_remaining("cohortpeople", "cohort_id"), [5])
예제 #5
0
def delete_clickhouse_data(team_ids: List[int]) -> None:
    from ee.clickhouse.models.team import delete_teams_data

    delete_teams_data(team_ids)