You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2019/11/15 23:32:06 UTC

[allura] 04/07: misc

This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch db/8340
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 8f045bcac47819a1eb8679efe145782cb4d0588a
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Fri Nov 15 17:55:00 2019 -0500

    misc
---
 Allura/allura/tests/functional/test_root.py |  5 +++++
 Allura/allura/tests/test_utils.py           | 18 +++++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/Allura/allura/tests/functional/test_root.py b/Allura/allura/tests/functional/test_root.py
index ca078fb..e6a6bc7 100644
--- a/Allura/allura/tests/functional/test_root.py
+++ b/Allura/allura/tests/functional/test_root.py
@@ -199,6 +199,11 @@ class TestRootController(TestController):
                          NeighborhoodController.index.__wrapped__)
             set_transaction_name.assert_called_with('foo')
 
+    def test_error_page(self):
+        # hard to force a real error (esp. with middleware debugging being different for tests) but we can hit direct:
+        r = self.app.get('/error/document')
+        r.mustcontain("We're sorry but we weren't able to process")
+
 
 class TestRootWithSSLPattern(TestController):
     def setUp(self):
diff --git a/Allura/allura/tests/test_utils.py b/Allura/allura/tests/test_utils.py
index 8887cef..12017e2 100644
--- a/Allura/allura/tests/test_utils.py
+++ b/Allura/allura/tests/test_utils.py
@@ -410,4 +410,20 @@ def test_is_nofollow_url():
 def test_close_ipv4_addrs():
     assert utils.close_ipv4_addrs('1.2.3.4', '1.2.3.4')
     assert utils.close_ipv4_addrs('1.2.3.4', '1.2.3.255')
-    assert not utils.close_ipv4_addrs('1.2.3.4', '1.2.4.4')
\ No newline at end of file
+    assert not utils.close_ipv4_addrs('1.2.3.4', '1.2.4.4')
+
+
+def test_lsub_utf8():
+    assert_equal(b'asdf',
+                 utils.lsub_utf8(h.really_unicode('asdf').encode('utf-8'), 40))
+    assert_equal(b'as\xf0\x9f\x98\x84\xc2\xb6\xc2\xba\xc2\xb6',
+                 utils.lsub_utf8(h.really_unicode(u'as😄¶º¶').encode('utf-8'), 40))
+    assert_equal(b'as\xf0\x9f\x98\x84',
+                 utils.lsub_utf8(h.really_unicode(u'as😄¶º¶').encode('utf-8'), 6))
+    # these would truncate the smiley:
+    assert_equal(b'as',
+                 utils.lsub_utf8(h.really_unicode(u'as😄¶º¶').encode('utf-8'), 5))
+    assert_equal(b'as',
+                 utils.lsub_utf8(h.really_unicode(u'as😄¶º¶').encode('utf-8'), 4))
+    assert_equal(b'as',
+                 utils.lsub_utf8(h.really_unicode(u'as😄¶º¶').encode('utf-8'), 3))