| |
@@ -375,6 +375,37 @@
|
| |
assert repo.orphan_reason.reason == "reason"
|
| |
output = self.app.post(
|
| |
"/_dg/take_orphan/rpms/test4",
|
| |
+ headers=headers,
|
| |
+ json={'fas_username': 'jednorozec'},
|
| |
+ )
|
| |
+ assert output.status_code == 200
|
| |
+ data = json.loads(output.get_data(as_text=True))
|
| |
+ self.assertDictEqual(data, {"point_of_contact": "jednorozec"})
|
| |
+
|
| |
+ # refresh the repo object, so we have the current state
|
| |
+ self.session.refresh(repo)
|
| |
+ assert repo.user.user == "jednorozec"
|
| |
+ assert not repo.orphan_reason
|
| |
+
|
| |
+ assert mock_log.call_count == 1
|
| |
+
|
| |
+ @patch("pagure_distgit.plugin._is_active_in_pdc")
|
| |
+ @patch("pagure_distgit.plugin.pagure.lib.notify.log")
|
| |
+ def test_take_orphan_specify_fas(self, mock_log, mock_pdc):
|
| |
+ """
|
| |
+ Assert that package is correctly adopted.
|
| |
+ By user specified in the POST data
|
| |
+ """
|
| |
+ mock_pdc.return_value = True
|
| |
+ headers = {"Authorization": "token aaabbbcccddd"}
|
| |
+ repo = pagure.lib.query.get_authorized_project(
|
| |
+ self.session,
|
| |
+ "test4",
|
| |
+ namespace="rpms",
|
| |
+ )
|
| |
+ assert repo.orphan_reason.reason == "reason"
|
| |
+ output = self.app.post(
|
| |
+ "/_dg/take_orphan/rpms/test4",
|
| |
headers=headers,
|
| |
)
|
| |
assert output.status_code == 200
|
| |
@@ -388,6 +419,7 @@
|
| |
|
| |
assert mock_log.call_count == 1
|
| |
|
| |
+
|
| |
@patch.dict("pagure.config.config", {"PDC_URL": "invalid://"})
|
| |
@patch("pagure_distgit.plugin.requests")
|
| |
@patch("pagure_distgit.plugin.pagure.lib.notify.log")
|
| |
Fixes: releng#10394
Signed-off-by: Tomas Hrcka thrcka@redhat.com