Skip to content

Commit

Permalink
improving coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
devights committed Nov 6, 2019
1 parent ba68ff9 commit 4043d74
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 2 deletions.
2 changes: 1 addition & 1 deletion uw_adsel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _cohorts_from_json(self, response):
cohorts.append(cohort_model)
return cohorts

def get_majors(self, quarter_id, **kwargs):
def get_majors_by_qtr(self, quarter_id, **kwargs):
url = "{}/majors/details/{}".format(self.API, quarter_id)
response = self._get_resource(url)
majors = self._majors_from_json(response)
Expand Down
26 changes: 26 additions & 0 deletions uw_adsel/resources/adsel/file/api/v1/cohorts/1
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"cohorts": [{
"academicQtrKeyId": 1,
"cohortNbr": 1,
"cohortDescription": "This is a Cohort",
"cohortResidency": "WA",
"admitDecision": "Decision text",
"protectedGroupInd": true,
"activeCohortInd": true,
"assignedCount": 120
},
{
"academicQtrKeyId": 1,
"cohortNbr": 2,
"cohortDescription": "This is another cohort",
"cohortResidency": "INTL",
"admitDecision": "Decision text",
"protectedGroupInd": false,
"activeCohortInd": true,
"assignedCount": 0
}
],
"nextPage": "1",
"previousPage": "1",
"totalCount": 1
}
26 changes: 26 additions & 0 deletions uw_adsel/resources/adsel/file/api/v1/majors/details/1
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"majors": [{
"majorAbbr": "BIOL",
"academicQtrKeyId": 1,
"displayName": "Biology",
"college": "Science",
"division": "3A",
"majorPathway": 0,
"dtx": "string",
"assignedCount": 32
},
{
"majorAbbr": "CHEM",
"academicQtrKeyId": 1,
"displayName": "Chemistry",
"college": "Science",
"division": "6B2",
"majorPathway": 0,
"dtx": "string",
"assignedCount": 0
}
],
"nextPage": "1",
"previousPage": "1",
"totalCount": 1
}
6 changes: 5 additions & 1 deletion uw_adsel/tests/test_adsel.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ def test_error(self):
self.adsel._get_resource("/foobar/")

def test_get_majors(self):
majors = self.adsel.get_majors(0)
majors = self.adsel.get_majors_by_qtr(0)
self.assertEqual(len(majors), 4)
self.assertEqual(majors[2].major_abbr, "CSE")
majors_unpaginated = self.adsel.get_majors_by_qtr(1)
self.assertEqual(len(majors_unpaginated), 2)

def test_get_quarters(self):
quarters = self.adsel.get_quarters()
Expand All @@ -30,3 +32,5 @@ def test_get_cohorts(self):
cohorts = self.adsel.get_cohorts_by_qtr(0)
self.assertEqual(len(cohorts), 4)
self.assertEqual(cohorts[2].cohort_description, "Second Page Cohort")
cohorts_unpaginated = self.adsel.get_cohorts_by_qtr(1)
self.assertEqual(len(cohorts_unpaginated), 2)

0 comments on commit 4043d74

Please sign in to comment.