Skip to content

Commit

Permalink
Fix/remove mixpanel integration (#2036)
Browse files Browse the repository at this point in the history
* fix: remove mixpanel integration from login

* fix: remove mixpanel python package

* fix: remove mixpanel token from workflows

* fix: remove mixpabel token from env example

* fix: remove mixpanel from tests

* chore: update poetry lock
  • Loading branch information
andrewleith authored Jan 8, 2025
1 parent 6d986b2 commit 791d2e5
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 160 deletions.
2 changes: 0 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@ AWS_SECRET_ACCESS_KEY=

REDIS_ENABLED=False

MIXPANEL_PROJECT_TOKEN=<project_token>

ALLOW_DEBUG_ROUTE=False
DEBUG_KEY=
1 change: 0 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
- run: /bin/bash -c "scripts/bootstrap.sh && poetry run make test"
env:
A11Y_TRACKER_KEY: ${{ secrets.A11Y_TRACKER_KEY }}
MIXPANEL_PROJECT_TOKEN: <project_token>
- name: Notify Slack channel if this job failed in default branch
if: ${{ failure() && github.ref == 'refs/heads/main' }}
run: |
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test_prod_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ jobs:
- run: /bin/bash -c "scripts/bootstrap.sh && poetry run make test"
env:
A11Y_TRACKER_KEY: ${{ secrets.A11Y_TRACKER_KEY }}
MIXPANEL_PROJECT_TOKEN: <project_token>
- name: Notify Slack channel if this job failed in default branch
if: ${{ failure() && github.ref == 'refs/heads/main' }}
run: |
Expand Down
5 changes: 0 additions & 5 deletions app/main/views/authenticator.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
from flask import session

from app.models.user import User
from config.mixpanel import NotifyMixpanel


class Authenticator:
def __init__(self, user_id):
self.user = User.from_id(user_id)
self.mixpanel = NotifyMixpanel()

def __enter__(self) -> User:
# the user will have a new current_session_id set by the API - store it in the cookie for future requests
Expand All @@ -23,9 +21,6 @@ def __enter__(self) -> User:
return self.user

def __exit__(self, _exec_type, _exec_value, _traceback) -> None:
self.mixpanel.track_user_profile(self.user)
self.mixpanel.track_event(self.user, "Notify: Logged in")

# get rid of anything in the session that we don't expect to have been set during register/sign in flow
session.pop("user_details", None)
session.pop("file_uploads", None)
1 change: 0 additions & 1 deletion ci/cloudbuild-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ steps:
args: ["-c", "/workspace/scripts/bootstrap.sh && make test"]
env:
- 'CHROMEDRIVER_PATH=/usr/bin/chromedriver'
- 'MIXPANEL_PROJECT_TOKEN=<project_token>'
options:
machineType: 'N1_HIGHCPU_32'
45 changes: 0 additions & 45 deletions config/mixpanel.py

This file was deleted.

18 changes: 1 addition & 17 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ WTForms = "3.1.2"
email-validator = "1.3.1"
Werkzeug = "3.0.4"
greenlet = "3.1.1"
mixpanel = "4.10.1"
unidecode = "^1.3.8"

# PaaS
Expand Down
12 changes: 0 additions & 12 deletions tests/app/main/views/test_new_password.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import json
import os
from datetime import datetime
from unittest import mock

Expand All @@ -11,17 +10,6 @@
from tests.conftest import url_for_endpoint_with_token


@pytest.fixture(autouse=True)
def stub_mixpanel(mocker):
environment_vars = os.environ.copy()
os.environ["MIXPANEL_PROJECT_TOKEN"] = "project_token_from_mixpanel"
mocker.patch("mixpanel.Mixpanel")

yield

os.environ = environment_vars


def test_should_render_new_password_template(
app_,
client,
Expand Down
13 changes: 0 additions & 13 deletions tests/app/main/views/test_two_factor.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
import os

import pytest
from bs4 import BeautifulSoup
from flask import url_for

from tests.conftest import SERVICE_ONE_ID, captured_templates


@pytest.fixture(autouse=True)
def stub_mixpanel(mocker):
environment_vars = os.environ.copy()
os.environ["MIXPANEL_PROJECT_TOKEN"] = "project_token_from_mixpanel"
mocker.patch("mixpanel.Mixpanel")

yield

os.environ = environment_vars


def test_should_render_sms_two_factor_page(
client,
api_user_active,
Expand Down
62 changes: 0 additions & 62 deletions tests/config/test_mixpanel.py

This file was deleted.

0 comments on commit 791d2e5

Please sign in to comment.