1515"""
1616
1717import json
18- import os
1918import time
2019from datetime import datetime , timezone
2120
2423from confluent_kafka import Consumer , KafkaError
2524from dotenv import load_dotenv
2625
26+ from tests .utilities import env_vars
2727from tests .utils import get_kafka_broker_url
2828
2929# Load environment variables from .env file if it exists
@@ -37,7 +37,7 @@ def test_tracking_api_mixpanel(auth_session, graph_client):
3737 """Test that we can post events to the tracking endpoint and verify they are sent to Mixpanel."""
3838
3939 # Check if Mixpanel API secret is available in environment variables
40- api_secret = os . environ . get ( "MIXPANEL_API_SECRET" )
40+ api_secret = env_vars . get_mixpanel_api_secret ( )
4141 if not api_secret :
4242 pytest .skip ("MIXPANEL_API_SECRET environment variable not set, skipping test" )
4343
@@ -80,9 +80,7 @@ def test_tracking_api_mixpanel(auth_session, graph_client):
8080
8181 # Query Mixpanel's JQL API to retrieve our test event
8282 # Note: This requires a service account with access to JQL
83- project_id = os .environ .get (
84- "MIXPANEL_PROJECT_ID" , "3653440"
85- ) # Allow project ID to be configurable too
83+ project_id = env_vars .get_mixpanel_project_id ()
8684
8785 # log the unique_id
8886 print (f"\n Looking for test event with customField: { unique_id } " )
@@ -357,8 +355,8 @@ def test_tracking_api_elasticsearch(auth_session):
357355
358356 # Query Elasticsearch to retrieve our test event
359357 # This requires the Elasticsearch URL and credentials
360- es_url = os . environ . get ( "ELASTICSEARCH_URL" , "http://localhost:9200" )
361- es_index = os . environ . get ( "ELASTICSEARCH_INDEX" , "datahub_usage_event" )
358+ es_url = env_vars . get_elasticsearch_url ( )
359+ es_index = env_vars . get_elasticsearch_index ( )
362360
363361 # Create a query to find our test event by the unique browserId and customField
364362 es_query = {
0 commit comments