allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [15/16] allura git commit: [#8230] Add unit tests for ForgeGit get_markdown and update_markdown
Date Mon, 15 Oct 2018 16:02:39 GMT
[#8230] Add unit tests for ForgeGit get_markdown and update_markdown


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/c07970e4
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/c07970e4
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/c07970e4

Branch: refs/heads/master
Commit: c07970e4e7492e62d4d9f8252f0c7d1cfc4af423
Parents: 81ac3b1
Author: Shalitha <shalithasuranga@gmail.com>
Authored: Sat Oct 13 21:00:45 2018 +0530
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Mon Oct 15 15:50:29 2018 +0000

----------------------------------------------------------------------
 .../tests/functional/test_controllers.py        | 32 ++++++++++++++++++++
 1 file changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/c07970e4/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index fb4377d..4bcffce 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -800,6 +800,38 @@ class TestFork(_TestCase):
         r = self.app.get('/p/test/src-git/merge-requests').follow()
         assert '<a href="1/">changed summary</a>' in r
 
+    def test_merge_request_get_markdown(self):
+        self.app.post('/p/test2/code/do_request_merge',
+                          params={
+                              'source_branch': 'zz',
+                              'target_branch': 'master',
+                              'summary': 'summary',
+                              'description': 'description',
+                          })
+        response = self.app.get('/p/test/src-git/merge-requests/1/get_markdown')
+        assert 'description' in response
+
+    def test_merge_request_update_markdown(self):
+        self.app.post('/p/test2/code/do_request_merge',
+                          params={
+                              'source_branch': 'zz',
+                              'target_branch': 'master',
+                              'summary': 'summary',
+                              'description': 'description',
+                          })
+        response = self.app.post(
+            '/p/test/src-git/merge-requests/1/update_markdown',
+            params={
+                'text': '- [x] checkbox'})
+        assert response.json['status'] == 'success'
+        # anon users can't edit markdown
+        response = self.app.post(
+            '/p/test/src-git/merge-requests/1/update_markdown',
+            params={
+                'text': '- [x] checkbox'},
+            extra_environ=dict(username='*anonymous'))
+        assert response.json['status'] == 'no_permission'
+
     @patch.object(GM.Repository, 'merge_request_commits', autospec=True)
     def test_merge_request_commits_error(self, mr_commits):
         r, mr_num = self._request_merge()


Mime
View raw message