This is an automated email from the ASF dual-hosted git repository.
dill0wn 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 39a8e1bbd [#8503] deprecation warnings - hotfix for failing tests
39a8e1bbd is described below
commit 39a8e1bbd8ac11aa6a90f0dc46349cb67bde487e
Author: Dillon Walls <[email protected]>
AuthorDate: Fri Mar 17 20:58:36 2023 +0000
[#8503] deprecation warnings - hotfix for failing tests
---
Allura/allura/lib/markdown_extensions.py | 4 +-
Allura/allura/tests/test_globals.py | 8 ++--
ForgeImporters/forgeimporters/base.py | 2 +-
.../forgeimporters/trac/tests/test_tickets.py | 50 +++++++++++-----------
4 files changed, 31 insertions(+), 33 deletions(-)
diff --git a/Allura/allura/lib/markdown_extensions.py
b/Allura/allura/lib/markdown_extensions.py
index f87c18ce1..40c463487 100644
--- a/Allura/allura/lib/markdown_extensions.py
+++ b/Allura/allura/lib/markdown_extensions.py
@@ -114,7 +114,6 @@ class CommitMessageExtension(markdown.Extension):
# remove all default block processors except for paragraph
clear_markdown_registry(md.parser.blockprocessors, keep=['paragraph'])
-
# wrap artifact link text in square brackets
self.forge_link_tree_processor = ForgeLinkTreeProcessor(md)
md.treeprocessors.register(self.forge_link_tree_processor, 'links', 0)
@@ -296,8 +295,7 @@ class ForgeExtension(markdown.Extension):
md.inlinePatterns.register(ForgeMacroPattern(MACRO_PATTERN, md,
ext=self), 'macro', 165) # similar to above
self.forge_link_tree_processor = ForgeLinkTreeProcessor(md)
- md.treeprocessors.register(self.forge_link_tree_processor, 'links',
100)
-
+ md.treeprocessors.register(self.forge_link_tree_processor, 'links', 0)
# Sanitize HTML
md.postprocessors.register(HTMLSanitizer(), 'sanitize_html', 5)
# Rewrite all relative links that don't start with . to have a '../'
prefix
diff --git a/Allura/allura/tests/test_globals.py
b/Allura/allura/tests/test_globals.py
index 1d26e0485..755f4fda2 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -395,14 +395,14 @@ class Test():
def test_wiki_artifact_links(self):
text = g.markdown.convert('See [18:13:49]')
- assert 'See <span>[18:13:49]</span>' in text, text
+ assert 'See <span>[18:13:49]</span>' in text
with h.push_context('test', 'wiki', neighborhood='Projects'):
text = g.markdown.convert('Read [here](Home) about our project')
- assert '<a class="" href="/p/test/wiki/Home/">here</a>' in text,
text
+ assert '<a class="" href="/p/test/wiki/Home/">here</a>' in text
text = g.markdown.convert('[Go home](test:wiki:Home)')
- assert '<a class="" href="/p/test/wiki/Home/">Go home</a>' in
text, text
+ assert '<a class="" href="/p/test/wiki/Home/">Go home</a>' in text
text = g.markdown.convert('See [test:wiki:Home]')
- assert '<a class="alink"
href="/p/test/wiki/Home/">[test:wiki:Home]</a>' in text, text
+ assert '<a class="alink"
href="/p/test/wiki/Home/">[test:wiki:Home]</a>' in text
def test_markdown_links(self):
with patch.dict(tg.config, {'nofollow_exempt_domains': 'foobar.net'}):
diff --git a/ForgeImporters/forgeimporters/base.py
b/ForgeImporters/forgeimporters/base.py
index 59c729acf..8119d7f35 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -348,7 +348,7 @@ class ToolImportControllerMeta(type):
the appropriate App for this controller's importer.
"""
- if hasattr(cls, 'create') and getattr(cls.create.decoration,
'validations', None) is None:
+ if hasattr(cls, 'create') and not getattr(cls.create.decoration,
'validations', None):
index_meth = getattr(cls.index, '__func__', cls.index)
cls.create =
validate(cls.import_form(aslist(importer.target_app)[0]),
error_handler=index_meth)(cls.create)
diff --git a/ForgeImporters/forgeimporters/trac/tests/test_tickets.py
b/ForgeImporters/forgeimporters/trac/tests/test_tickets.py
index e5042ce9a..6d0915e0c 100644
--- a/ForgeImporters/forgeimporters/trac/tests/test_tickets.py
+++ b/ForgeImporters/forgeimporters/trac/tests/test_tickets.py
@@ -182,31 +182,31 @@ class TestTracTicketImportController(TestController,
TestCase):
)])
self.assertEqual(import_tool.post.call_count, 0)
- @with_tracker
- @patch('forgeimporters.trac.requests.head')
- @patch('forgeimporters.base.import_tool')
- def test_url_ticket_import_fail(self, import_tool, head):
- head.return_value.status_code = 200
- params = dict(trac_url='https://sf-1.xb.sf.net/trac/url',
- mount_label='mylabel',
- mount_point='mymount',
- )
- r =
self.app.post('/p/test/admin/ext/import/trac-tickets-sf/create', params,
- status=200)
- self.assertIn('Invalid URL', r.text)
-
- @with_wiki
- @patch('forgeimporters.trac.requests.head')
- @patch('forgeimporters.base.import_tool')
- def test_url_wiki_import_fail(self, import_tool, head):
- head.return_value.status_code = 200
- params = dict(trac_url='https://sf-1.xb.sf.net/trac/url',
- mount_label='mylabel',
- mount_point='mymount',
- )
- r = self.app.post('/p/test/admin/ext/import/trac-wiki/create',
params,
- status=200)
- self.assertIn('Invalid URL', r.text)
+ @with_tracker
+ @patch('forgeimporters.trac.requests.head')
+ @patch('forgeimporters.base.import_tool')
+ def test_url_ticket_import_fail(self, import_tool, head):
+ head.return_value.status_code = 200
+ params = dict(trac_url='https://sf-1.xb.sf.net/trac/url',
+ mount_label='mylabel',
+ mount_point='mymount',
+ )
+ r = self.app.post('/p/test/admin/ext/import/trac-tickets-sf/create',
params,
+ status=200)
+ self.assertIn('Invalid URL', r.text)
+
+ @with_wiki
+ @patch('forgeimporters.trac.requests.head')
+ @patch('forgeimporters.base.import_tool')
+ def test_url_wiki_import_fail(self, import_tool, head):
+ head.return_value.status_code = 200
+ params = dict(trac_url='https://sf-1.xb.sf.net/trac/url',
+ mount_label='mylabel',
+ mount_point='mymount',
+ )
+ r = self.app.post('/p/test/admin/ext/import/trac-wiki/create', params,
+ status=200)
+ self.assertIn('Invalid URL', r.text)
class TestTracImportSupport(TestCase):