forked from CCI-MOC/invoicing
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow a PI's institution name to be search with subdomains
Now, for PIs whose emails contain multiple subdomains (i.e `[email protected]`), each of their subdomains will be matched against institute_map.json, from the most qualified to least qualified subdomain. In the example of `[email protected]`, this means `b.c.edu` would be matched first, then `c.edu`, then `edu`
- Loading branch information
Showing
3 changed files
with
18 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -234,29 +234,19 @@ def test_get_pi_institution(self): | |
"northeastern.edu": "Northeastern University", | ||
} | ||
|
||
self.assertEqual( | ||
process_report.get_institution_from_pi(institute_map, "[email protected]"), | ||
"Boston University", | ||
) | ||
self.assertEqual( | ||
process_report.get_institution_from_pi( | ||
institute_map, "[email protected]" | ||
), | ||
"McLean Hospital", | ||
) | ||
self.assertEqual( | ||
process_report.get_institution_from_pi(institute_map, "[email protected]"), | ||
"Harvard University", | ||
) | ||
self.assertEqual( | ||
process_report.get_institution_from_pi(institute_map, "fake"), "" | ||
) | ||
self.assertEqual( | ||
process_report.get_institution_from_pi( | ||
institute_map, "[email protected]" | ||
), | ||
"Northeastern University", | ||
) | ||
answers = { | ||
"[email protected]": "Boston University", | ||
"[email protected]": "McLean Hospital", | ||
"[email protected]": "Harvard University", | ||
"e@edu": "", | ||
"[email protected]": "Northeastern University", | ||
"[email protected]": "Harvard University", | ||
} | ||
|
||
for pi_email, answer in answers.items(): | ||
self.assertEqual( | ||
process_report.get_institution_from_pi(institute_map, pi_email), answer | ||
) | ||
|
||
|
||
class TestAlias(TestCase): | ||
|