Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Use pytest-env to set up API key (#3272)

Kenneth Ng910cc68248a6
diff --git a/catalog/env.template b/catalog/env.template
index 4ad3b05bb..2c5812d40 100644
--- a/catalog/env.template
+++ b/catalog/env.template
@@ -26,17 +26,8 @@ AIRFLOW_VAR_ENVIRONMENT=dev
# API Keys
########################################################################################
# See: https://airflow.apache.org/docs/apache-airflow/stable/howto/variable.html#storing-variables-in-environment-variables
-AIRFLOW_VAR_API_KEY_BROOKLYN_MUSEUM=not_set
-AIRFLOW_VAR_API_KEY_DATA_GOV=not_set
-AIRFLOW_VAR_API_KEY_EUROPEANA=not_set
-AIRFLOW_VAR_API_KEY_FLICKR=not_set
-AIRFLOW_VAR_API_KEY_FREESOUND=not_set
-AIRFLOW_VAR_API_KEY_JAMENDO=not_set
-AIRFLOW_VAR_API_KEY_JUSTTAKEITFREE=not_set
-AIRFLOW_VAR_API_KEY_NYPL=not_set
-AIRFLOW_VAR_API_KEY_RAWPIXEL=not_set
-AIRFLOW_VAR_API_KEY_THINGIVERSE=not_set
-AIRFLOW_VAR_API_KEY_WALTERS_ART_MUSEUM=not_set
+# Example:
+# AIRFLOW_VAR_API_KEY_BROOKLYN_MUSEUM=apikey
########################################################################################
diff --git a/catalog/pytest.ini b/catalog/pytest.ini
index c6cf18384..96cafe324 100644
--- a/catalog/pytest.ini
+++ b/catalog/pytest.ini
@@ -39,3 +39,16 @@ filterwarnings=
# structure due to permissions issues
# https://stackoverflow.com/a/56493748/3277713
cache_dir=/home/airflow/.cache/pytest
+
+env =
+ AIRFLOW_VAR_API_KEY_BROOKLYN_MUSEUM=apikey
+ AIRFLOW_VAR_API_KEY_DATA_GOV=apikey
+ AIRFLOW_VAR_API_KEY_EUROPEANA=apikey
+ AIRFLOW_VAR_API_KEY_FLICKR=apikey
+ AIRFLOW_VAR_API_KEY_FREESOUND=apikey
+ AIRFLOW_VAR_API_KEY_JAMENDO=apikey
+ AIRFLOW_VAR_API_KEY_JUSTTAKEITFREE=apikey
+ AIRFLOW_VAR_API_KEY_NYPL=apikey
+ AIRFLOW_VAR_API_KEY_RAWPIXEL=apikey
+ AIRFLOW_VAR_API_KEY_THINGIVERSE=apikey
+ AIRFLOW_VAR_API_KEY_WALTERS_ART_MUSEUM=apikey
diff --git a/catalog/requirements_dev.txt b/catalog/requirements_dev.txt
index d1e577fa5..f556d9eb4 100644
--- a/catalog/requirements_dev.txt
+++ b/catalog/requirements_dev.txt
@@ -5,6 +5,7 @@
flaky==3.7.0
ipython
pook==1.1.1
+pytest-env
pytest-mock==3.11.1
pytest-raises==0.11
pytest-socket==0.6.0