-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't silently strip numbers from a CO shortname in the Org API (fixes …
- Loading branch information
1 parent
da182b9
commit bc89f99
Showing
2 changed files
with
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -692,7 +692,7 @@ def test_api_call_existing_short_name(self): | |
data=json.dumps({ | ||
"name": "new_collaboration", | ||
"administrators": ["[email protected]"], | ||
"short_name": f"1{ai_computing_short_name}", | ||
"short_name": f"{ai_computing_short_name}", | ||
"description": "new_collaboration", | ||
"accepted_user_policy": "https://aup.org", | ||
"disable_join_requests": True, | ||
|
@@ -748,6 +748,40 @@ def test_api_call_with_invalid_short_name(self): | |
response_json = response.json | ||
self.assertTrue("Invalid CO short_name" in response_json["message"]) | ||
|
||
def test_api_call_with_invalid_short_name_2(self): | ||
response = self.client.post("/api/collaborations/v1", | ||
headers={"Authorization": f"Bearer {uuc_secret}"}, | ||
data=json.dumps({ | ||
"name": "new_collaboration", | ||
"description": "new_collaboration", | ||
"administrators": ["[email protected]", "[email protected]"], | ||
"short_name": "lang56789012345678901234567890", | ||
"disable_join_requests": True, | ||
"disclose_member_information": True, | ||
"disclose_email_information": True | ||
}), | ||
content_type="application/json") | ||
self.assertEqual(400, response.status_code) | ||
response_json = response.json | ||
self.assertTrue("Invalid CO short_name" in response_json["message"]) | ||
|
||
def test_api_call_with_invalid_short_name_3(self): | ||
response = self.client.post("/api/collaborations/v1", | ||
headers={"Authorization": f"Bearer {uuc_secret}"}, | ||
data=json.dumps({ | ||
"name": "new_collaboration", | ||
"description": "new_collaboration", | ||
"administrators": ["[email protected]", "[email protected]"], | ||
"short_name": "12begincijfer", | ||
"disable_join_requests": True, | ||
"disclose_member_information": True, | ||
"disclose_email_information": True | ||
}), | ||
content_type="application/json") | ||
self.assertEqual(400, response.status_code) | ||
response_json = response.json | ||
self.assertTrue("Invalid CO short_name" in response_json["message"]) | ||
|
||
def test_collaborations_may_request_collaboration_true(self): | ||
self.login("urn:mary") | ||
res = self.get("/api/collaborations/may_request_collaboration", with_basic_auth=False) | ||
|