This is an automated email from the ASF dual-hosted git repository.
dill0wn pushed a commit to branch dw/8455
in repository https://gitbox.apache.org/repos/asf/allura.git
The following commit(s) were added to refs/heads/dw/8455 by this push:
new 52939214b fixup! fixup! fixup! fixup! [#8455] allura pytest - fix misc
test failures that popped up during pytest conversion
52939214b is described below
commit 52939214bf190645c5c4154cfc8d4cd49022f50c
Author: Dillon Walls <[email protected]>
AuthorDate: Thu Sep 15 16:48:00 2022 +0000
fixup! fixup! fixup! fixup! [#8455] allura pytest - fix misc test failures
that popped up during pytest conversion
---
.../allura/tests/functional/test_user_profile.py | 70 ++++++++++++----------
1 file changed, 40 insertions(+), 30 deletions(-)
diff --git a/Allura/allura/tests/functional/test_user_profile.py
b/Allura/allura/tests/functional/test_user_profile.py
index 4a54ffa69..e4df160e1 100644
--- a/Allura/allura/tests/functional/test_user_profile.py
+++ b/Allura/allura/tests/functional/test_user_profile.py
@@ -26,6 +26,46 @@ from allura.tests import TestController
from allura.tests.pytest_helpers import with_nose_compatibility
+class TestUserProfileSections(TestController):
+
+ def teardown_method(self, method):
+ super().teardown_method(method)
+ project = Project.query.get(shortname='u/test-user')
+ app = project.app_instance('profile')
+ if hasattr(type(app), '_sections'):
+ delattr(type(app), '_sections')
+
+ @td.with_user_project('test-user')
+ def test_profile_sections(self):
+ project = Project.query.get(shortname='u/test-user')
+ app = project.app_instance('profile')
+
+ def ep(n):
+ m = mock.Mock()
+ m.name = n
+ m.load()().display.return_value = 'Section %s' % n
+ return m
+ eps = list(map(ep, ['a', 'b', 'c', 'd']))
+ order = {'user_profile_sections.order': 'b, d,c , f '}
+ if hasattr(type(app), '_sections'):
+ delattr(type(app), '_sections')
+ with mock.patch('allura.lib.helpers.iter_entry_points') as iep:
+ with mock.patch.dict(tg.config, order):
+ iep.return_value = eps
+ sections = app.profile_sections
+ assert sections == [
+ eps[1].load(),
+ eps[3].load(),
+ eps[2].load(),
+ eps[0].load()]
+ r = self.app.get('/u/test-user/profile')
+ assert 'Section a' in r.text
+ assert 'Section b' in r.text
+ assert 'Section c' in r.text
+ assert 'Section d' in r.text
+ assert 'Section f' not in r.text
+
+
@with_nose_compatibility
class TestUserProfile(TestController):
@@ -230,36 +270,6 @@ class TestUserProfile(TestController):
r = self.app.get('/u/test-user/profile/send_message', status=200)
assert 'you currently have user messages disabled' in r
- @td.with_user_project('test-user')
- def test_profile_sections(self):
- project = Project.query.get(shortname='u/test-user')
- app = project.app_instance('profile')
-
- def ep(n):
- m = mock.Mock()
- m.name = n
- m.load()().display.return_value = 'Section %s' % n
- return m
- eps = list(map(ep, ['a', 'b', 'c', 'd']))
- order = {'user_profile_sections.order': 'b, d,c , f '}
- if hasattr(type(app), '_sections'):
- delattr(type(app), '_sections')
- with mock.patch('allura.lib.helpers.iter_entry_points') as iep:
- with mock.patch.dict(tg.config, order):
- iep.return_value = eps
- sections = app.profile_sections
- assert sections == [
- eps[1].load(),
- eps[3].load(),
- eps[2].load(),
- eps[0].load()]
- r = self.app.get('/u/test-user/profile')
- assert 'Section a' in r.text
- assert 'Section b' in r.text
- assert 'Section c' in r.text
- assert 'Section d' in r.text
- assert 'Section f' not in r.text
-
def test_no_index_tag_in_empty_profile(self):
r = self.app.get('/u/test-user/profile/')
assert 'content="noindex, follow"' in r.text