-
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.
fix: handle corner cases for quota emails (#319)
- Loading branch information
Showing
3 changed files
with
106 additions
and
3 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 |
---|---|---|
|
@@ -506,6 +506,40 @@ def test_generate_quota_report_red(self): | |
|
||
self.assertDictEqual(user.generate_quota_report(), expected) | ||
|
||
def test_generate_quota_report_zero_quota(self): | ||
user = self.factory( | ||
resources_requested={TIER_USER_HOME: 0}, | ||
resources_used={TIER_USER_HOME: 0}, | ||
home_directory="/home/users", | ||
) | ||
expected = { | ||
"used": {TIER_USER_HOME: 0}, | ||
"requested": {TIER_USER_HOME: 0}, | ||
"percentage": {TIER_USER_HOME: 0}, | ||
"status": {TIER_USER_HOME: HpcQuotaStatus.GREEN}, | ||
"folders": {TIER_USER_HOME: "/home/users"}, | ||
"warnings": [], | ||
} | ||
|
||
self.assertDictEqual(user.generate_quota_report(), expected) | ||
|
||
def test_generate_quota_report_no_resources(self): | ||
user = self.factory( | ||
resources_requested={}, | ||
resources_used={}, | ||
home_directory="/home/users", | ||
) | ||
expected = { | ||
"used": {}, | ||
"requested": {}, | ||
"percentage": {}, | ||
"status": {}, | ||
"folders": {}, | ||
"warnings": ["No resources available."], | ||
} | ||
|
||
self.assertDictEqual(user.generate_quota_report(), expected) | ||
|
||
def test_parse_email(self): | ||
email = parse_email("[email protected]") | ||
self.assertEqual(email, "[email protected]") | ||
|