diff --git a/microsetta_private_api/client/tests/test_myfoodrepo.py b/microsetta_private_api/client/tests/test_myfoodrepo.py index 0857ddd15..d41001b73 100644 --- a/microsetta_private_api/client/tests/test_myfoodrepo.py +++ b/microsetta_private_api/client/tests/test_myfoodrepo.py @@ -5,22 +5,20 @@ from microsetta_private_api.config_manager import SERVER_CONFIG +# The MFR URL and API key are encoded as github repository secrets. +# Secrets are not passed when a fork issues a PR. This test will still +# execute from master once a PR is merged. +@skipIf(SERVER_CONFIG['myfoodrepo_url'] in ('', 'mfr_url_placeholder'), + "MFR secrets not provided") class MFRTests(TestCase): def setUp(self): - self.c = MFRClient('ucsd_test_ch') + self.c = MFRClient(SERVER_CONFIG['myfoodrepo_study']) - # The MFR URL and API key are encoded as github repository secrets. - # Secrets are not passed when a fork issues a PR. This test will still - # execute from master once a PR is merged. - @skipIf(SERVER_CONFIG['myfoodrepo_url'] in ('', 'mfr_url_placeholder'), - "MFR secrets not provided") def test_default_cohort(self): cohorts = self.c.cohorts() self.assertEqual(self.c.default_cohort, cohorts.data.cohorts[0].codename) - @skipIf(SERVER_CONFIG['myfoodrepo_url'] in ('', 'mfr_url_placeholder'), - "MFR secrets not provided") def test_create_get_delete(self): cohorts = self.c.cohorts() self.assertTrue(len(cohorts.data.cohorts) >= 1) diff --git a/microsetta_private_api/server_config.json b/microsetta_private_api/server_config.json index 5b4f9a299..9adde7a50 100644 --- a/microsetta_private_api/server_config.json +++ b/microsetta_private_api/server_config.json @@ -34,6 +34,7 @@ "myfoodrepo_key": "mfr_key_placeholder", "myfoodrepo_slots": 15, "myfoodrepo_study": "mfr_study_placeholder", + "myfoodrepo_cohort": "testing", "myfoodrepo_participation_days": 8, "fundrazr_key": "fundrazr_api_placeholder", "fundrazr_url": "fundrazr_url_placeholder", diff --git a/microsetta_private_api/util/myfoodrepo.py b/microsetta_private_api/util/myfoodrepo.py index b116c8125..8ba773276 100644 --- a/microsetta_private_api/util/myfoodrepo.py +++ b/microsetta_private_api/util/myfoodrepo.py @@ -17,7 +17,7 @@ def create_subj(): client = MFRClient(SERVER_CONFIG["myfoodrepo_study"]) participation_length = SERVER_CONFIG["myfoodrepo_participation_days"] - cohort = client.default_cohort + cohort = SERVER_CONFIG['myfoodrepo_cohort'] subj = client.create_subj(cohort) subj_id = subj.data.subject.key