You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/04/21 11:33:38 UTC
[11/14] allura git commit: [#7866] ticket:754 Test can_merge task
[#7866] ticket:754 Test can_merge task
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/f32d2c38
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/f32d2c38
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/f32d2c38
Branch: refs/heads/ib/7866
Commit: f32d2c387986eb29a3e53d76f0a0b4e34d7162f6
Parents: b76a949
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Apr 20 10:11:15 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Apr 21 08:15:32 2015 +0000
----------------------------------------------------------------------
Allura/allura/tasks/repo_tasks.py | 2 --
Allura/allura/tests/test_tasks.py | 9 +++++++++
2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/f32d2c38/Allura/allura/tasks/repo_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tasks/repo_tasks.py b/Allura/allura/tasks/repo_tasks.py
index 614b4b0..e44ea94 100644
--- a/Allura/allura/tasks/repo_tasks.py
+++ b/Allura/allura/tasks/repo_tasks.py
@@ -169,6 +169,4 @@ def can_merge(merge_request_id):
from allura import model as M
mr = M.MergeRequest.query.get(_id=merge_request_id)
result = mr.app.repo.can_merge(mr)
- source_hash = mr.downstream.commit_id
- target_hash = mr.app.repo.commit(mr.target_branch)._id
mr.set_can_merge_cache(result)
http://git-wip-us.apache.org/repos/asf/allura/blob/f32d2c38/Allura/allura/tests/test_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_tasks.py b/Allura/allura/tests/test_tasks.py
index d822229..4ad311c 100644
--- a/Allura/allura/tests/test_tasks.py
+++ b/Allura/allura/tests/test_tasks.py
@@ -75,6 +75,15 @@ class TestRepoTasks(unittest.TestCase):
session.assert_called_once_with(mr)
session.return_value.flush.assert_called_once_with(mr)
+ @mock.patch.object(M, 'MergeRequest', autospec=True)
+ def test_can_merge(self, MR):
+ mr = M.MergeRequest(_id='_id')
+ MR.query.get.return_value = mr
+ repo_tasks.can_merge(mr._id)
+ mr.app.repo.can_merge.assert_called_once_with(mr)
+ val = mr.app.repo.can_merge.return_value
+ mr.set_can_merge_cache.assert_called_once_with(val)
+
class TestEventTasks(unittest.TestCase):