Skip to content

Commit

Permalink
Merge pull request #426 from wasade/mfr_cohort_by_config
Browse files Browse the repository at this point in the history
Mfr cohort by config
  • Loading branch information
cassidysymons authored Mar 14, 2022
2 parents 2efa875 + dc2ca75 commit c2eceae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
14 changes: 6 additions & 8 deletions microsetta_private_api/client/tests/test_myfoodrepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions microsetta_private_api/server_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion microsetta_private_api/util/myfoodrepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c2eceae

Please sign in to comment.