This is an automated email from the ASF dual-hosted git repository.
gcruz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
The following commit(s) were added to refs/heads/master by this push:
new 1f9a81112 [#8492] test fix for test_remove_no_index_tag_profile
1f9a81112 is described below
commit 1f9a81112cbe4c48a3fd0b9e70f4d183b307be3c
Author: Guillermo Cruz <[email protected]>
AuthorDate: Fri Jan 27 09:05:51 2023 -0600
[#8492] test fix for test_remove_no_index_tag_profile
---
Allura/allura/tests/functional/test_discuss.py | 36 ++++++++++++----------
.../allura/tests/functional/test_user_profile.py | 8 +++--
2 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/Allura/allura/tests/functional/test_discuss.py
b/Allura/allura/tests/functional/test_discuss.py
index d27072b04..f87f4352d 100644
--- a/Allura/allura/tests/functional/test_discuss.py
+++ b/Allura/allura/tests/functional/test_discuss.py
@@ -41,6 +41,24 @@ class TestDiscussBase(TestController):
thread_link = new_post.find('form', {'id': 'edit_post'}).get('action')
return thread_link.split('/')[-2]
+ def _make_post(self, text, username='root'):
+ thread_link = self._thread_link()
+ thread = self.app.get(thread_link, expect_errors=True)
+ for f in thread.html.findAll('form'):
+ if f.get('action', '').endswith('/post'):
+ break
+ params = dict()
+ inputs = f.findAll('input')
+ for field in inputs:
+ if field.has_attr('name'):
+ params[field['name']] = field.get('value') or ''
+ params[f.find('textarea')['name']] = text
+ r = self.app.post(f['action'], params=params,
+ headers={'Referer': str(thread_link)},
+ status=302,
+ extra_environ=dict(username=username))
+ return self.app.get(r.response.headers['Location'], expect_errors=True)
+
class TestDiscuss(TestDiscussBase):
@@ -66,23 +84,7 @@ class TestDiscuss(TestDiscussBase):
r = self.app.post('/wiki/_discuss/subscribe', params=params)
assert not self._is_subscribed(user, thread)
- def _make_post(self, text):
- thread_link = self._thread_link()
- thread = self.app.get(thread_link, expect_errors=True)
- for f in thread.html.findAll('form'):
- if f.get('action', '').endswith('/post'):
- break
- params = dict()
- inputs = f.findAll('input')
- for field in inputs:
- if field.has_attr('name'):
- params[field['name']] = field.get('value') or ''
- params[f.find('textarea')['name']] = text
- r = self.app.post(f['action'], params=params,
- headers={'Referer': str(thread_link)},
- status=302,
- extra_environ=dict(username='root'))
- return self.app.get(r.response.headers['Location'], expect_errors=True)
+
@patch('allura.controllers.discuss.g.spam_checker.check')
@patch('allura.controllers.discuss.g.spam_checker.submit_spam')
diff --git a/Allura/allura/tests/functional/test_user_profile.py
b/Allura/allura/tests/functional/test_user_profile.py
index bfa920a81..76ec1dc9d 100644
--- a/Allura/allura/tests/functional/test_user_profile.py
+++ b/Allura/allura/tests/functional/test_user_profile.py
@@ -22,7 +22,7 @@ from alluratest.controller import TestRestApiBase
from allura.model import Project, User
from allura.tests import decorators as td
from allura.tests import TestController
-
+from allura.tests.functional.test_discuss import TestDiscussBase
class TestUserProfileSections(TestController):
@@ -64,7 +64,7 @@ class TestUserProfileSections(TestController):
assert 'Section f' not in r.text
-class TestUserProfile(TestController):
+class TestUserProfile(TestDiscussBase):
@td.with_user_project('test-admin')
def test_profile(self):
@@ -271,8 +271,10 @@ class TestUserProfile(TestController):
r = self.app.get('/u/test-user/profile/')
assert 'content="noindex, follow"' in r.text
+ @td.with_user_project('test-user')
def test_remove_no_index_tag_profile(self):
- r = self.app.get('/u/test-admin/profile/')
+ self._make_post("New Post...", 'test-user')
+ r = self.app.get('/u/test-user/profile/')
assert 'content="noindex, follow"' not in r.text