| |
@@ -84,6 +84,46 @@
|
| |
data = json.loads(output.get_data(as_text=True))
|
| |
self.assertDictEqual(data, datainput)
|
| |
|
| |
+ def test_change_invalid_fedora_assignee(self):
|
| |
+ """Test the bz endpoint when changing the Fedora assignee while keeping
|
| |
+ the EPEL one.
|
| |
+ """
|
| |
+ headers = {"Authorization": "token aaabbbcccddd"}
|
| |
+ datainput = {"epel_assignee": "foo", "fedora_assignee": "invalid"}
|
| |
+ expected_result = {
|
| |
+ "error": "Invalid or incomplete input submitted",
|
| |
+ "error_code": "EINVALIDREQ",
|
| |
+ "errors": ["Invalid user or group name as fedora_assignee"],
|
| |
+ }
|
| |
+ output = self.app.post(
|
| |
+ "/_dg/bzoverrides/somenamespace/test3",
|
| |
+ data=datainput,
|
| |
+ headers=headers,
|
| |
+ )
|
| |
+ self.assertEqual(output.status_code, 400)
|
| |
+ data = json.loads(output.get_data(as_text=True))
|
| |
+ self.assertDictEqual(data, expected_result)
|
| |
+
|
| |
+ def test_change_invalid_fedora_group_assignee(self):
|
| |
+ """Test the bz endpoint when changing the Fedora assignee while keeping
|
| |
+ the EPEL one.
|
| |
+ """
|
| |
+ headers = {"Authorization": "token aaabbbcccddd"}
|
| |
+ datainput = {"epel_assignee": "foo", "fedora_assignee": "@invalid"}
|
| |
+ expected_result = {
|
| |
+ "error": "Invalid or incomplete input submitted",
|
| |
+ "error_code": "EINVALIDREQ",
|
| |
+ "errors": ["Invalid user or group name as fedora_assignee"],
|
| |
+ }
|
| |
+ output = self.app.post(
|
| |
+ "/_dg/bzoverrides/somenamespace/test3",
|
| |
+ data=datainput,
|
| |
+ headers=headers,
|
| |
+ )
|
| |
+ self.assertEqual(output.status_code, 400)
|
| |
+ data = json.loads(output.get_data(as_text=True))
|
| |
+ self.assertDictEqual(data, expected_result)
|
| |
+
|
| |
def test_change_epel_assignee(self):
|
| |
"""Test the bz endpoint when changing the EPEL assignee while keeping
|
| |
the Fedora one.
|
| |
@@ -103,6 +143,46 @@
|
| |
data = json.loads(output.get_data(as_text=True))
|
| |
self.assertDictEqual(data, expected_result)
|
| |
|
| |
+ def test_change_invalid_epel_assignee(self):
|
| |
+ """Test the bz endpoint when changing the EPEL assignee while keeping
|
| |
+ the Fedora one.
|
| |
+ """
|
| |
+ headers = {"Authorization": "token aaabbbcccddd"}
|
| |
+ datainput = {"epel_assignee": "invalid", "fedora_assignee": None}
|
| |
+ expected_result = {
|
| |
+ "error": "Invalid or incomplete input submitted",
|
| |
+ "error_code": "EINVALIDREQ",
|
| |
+ "errors": ["Invalid user or group name as epel_assignee"],
|
| |
+ }
|
| |
+ output = self.app.post(
|
| |
+ "/_dg/bzoverrides/somenamespace/test3",
|
| |
+ data=datainput,
|
| |
+ headers=headers,
|
| |
+ )
|
| |
+ self.assertEqual(output.status_code, 400)
|
| |
+ data = json.loads(output.get_data(as_text=True))
|
| |
+ self.assertDictEqual(data, expected_result)
|
| |
+
|
| |
+ def test_change_invalid_epel_group_assignee(self):
|
| |
+ """Test the bz endpoint when changing the EPEL assignee while keeping
|
| |
+ the Fedora one.
|
| |
+ """
|
| |
+ headers = {"Authorization": "token aaabbbcccddd"}
|
| |
+ datainput = {"epel_assignee": "@invalid", "fedora_assignee": None}
|
| |
+ expected_result = {
|
| |
+ "error": "Invalid or incomplete input submitted",
|
| |
+ "error_code": "EINVALIDREQ",
|
| |
+ "errors": ["Invalid user or group name as epel_assignee"],
|
| |
+ }
|
| |
+ output = self.app.post(
|
| |
+ "/_dg/bzoverrides/somenamespace/test3",
|
| |
+ data=datainput,
|
| |
+ headers=headers,
|
| |
+ )
|
| |
+ self.assertEqual(output.status_code, 400)
|
| |
+ data = json.loads(output.get_data(as_text=True))
|
| |
+ self.assertDictEqual(data, expected_result)
|
| |
+
|
| |
def test_reset_fedora_assignees(self):
|
| |
"""Test the bz endpoint when resetting the Fedora assignee.
|
| |
"""
|
| |
@@ -189,7 +269,6 @@
|
| |
repo = pagure.lib.query.get_authorized_project(
|
| |
self.session, "test3", namespace="somenamespace",
|
| |
)
|
| |
- print(repo.bzoverride)
|
| |
self.assertIsNone(repo.bzoverride)
|
| |
|
| |
def test_changing_assignees_logged_in_invalid_user(self):
|
| |