You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by di...@apache.org on 2022/09/21 16:04:48 UTC

[allura] 03/03: fixup! [#8455] converted the remaining modules fully to pytest

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

dill0wn pushed a commit to branch dw/8455-part2
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 85f479ba3410dbefc2dd6bfb2dd49a2a2b18a0de
Author: Dillon Walls <di...@slashdotmedia.com>
AuthorDate: Wed Sep 21 16:04:17 2022 +0000

    fixup! [#8455] converted the remaining modules fully to pytest
---
 Allura/allura/tests/test_patches.py  | 8 ++++----
 Allura/allura/tests/test_webhooks.py | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/Allura/allura/tests/test_patches.py b/Allura/allura/tests/test_patches.py
index ddaa0027a..b66957c6f 100644
--- a/Allura/allura/tests/test_patches.py
+++ b/Allura/allura/tests/test_patches.py
@@ -32,7 +32,7 @@ def test_with_trailing_slash():
     patches.apply()
     with pytest.raises(webob.exc.HTTPMovedPermanently) as raised:
         tg.decorators.with_trailing_slash(empty_func)()
-    assert raised.exception.location == 'http://localhost/foo/bar/'
+    assert raised.value.location == 'http://localhost/foo/bar/'
 
 
 @patch.object(patches, 'request', webob.Request.blank('/foo/bar/?a=b'))
@@ -47,7 +47,7 @@ def test_with_trailing_slash_qs():
     patches.apply()
     with pytest.raises(webob.exc.HTTPMovedPermanently) as raised:
         tg.decorators.with_trailing_slash(empty_func)()
-    assert raised.exception.location == 'http://localhost/foo/bar/?foo=bar&baz=bam'
+    assert raised.value.location == 'http://localhost/foo/bar/?foo=bar&baz=bam'
 
 
 @patch.object(patches, 'request', webob.Request.blank('/foo/bar/'))
@@ -55,7 +55,7 @@ def test_without_trailing_slash():
     patches.apply()
     with pytest.raises(webob.exc.HTTPMovedPermanently) as raised:
         tg.decorators.without_trailing_slash(empty_func)()
-    assert raised.exception.location == 'http://localhost/foo/bar'
+    assert raised.value.location == 'http://localhost/foo/bar'
 
 
 @patch.object(patches, 'request', webob.Request.blank('/foo/bar?a=b'))
@@ -70,4 +70,4 @@ def test_without_trailing_slash_qs():
     patches.apply()
     with pytest.raises(webob.exc.HTTPMovedPermanently) as raised:
         tg.decorators.without_trailing_slash(empty_func)()
-    assert raised.exception.location == 'http://localhost/foo/bar?foo=bar&baz=bam'
+    assert raised.value.location == 'http://localhost/foo/bar?foo=bar&baz=bam'
diff --git a/Allura/allura/tests/test_webhooks.py b/Allura/allura/tests/test_webhooks.py
index c1eeaa0e8..b2958d7d2 100644
--- a/Allura/allura/tests/test_webhooks.py
+++ b/Allura/allura/tests/test_webhooks.py
@@ -97,10 +97,10 @@ class TestValidators(TestWebhookBase):
         v = WebhookValidator(sender=sender, app=app, not_empty=True)
         with pytest.raises(Invalid) as cm:
             v.to_python(None)
-        assert cm.exception.msg == 'Please enter a value'
+        assert cm.value.msg == 'Please enter a value'
         with pytest.raises(Invalid) as cm:
             v.to_python('invalid id')
-        assert cm.exception.msg == 'Invalid webhook'
+        assert cm.value.msg == 'Invalid webhook'
 
         wh = M.Webhook(type='invalid type',
                        app_config_id=invalid_app.config._id,
@@ -110,14 +110,14 @@ class TestValidators(TestWebhookBase):
         # invalid type
         with pytest.raises(Invalid) as cm:
             v.to_python(wh._id)
-        assert cm.exception.msg == 'Invalid webhook'
+        assert cm.value.msg == 'Invalid webhook'
 
         wh.type = 'repo-push'
         session(wh).flush(wh)
         # invalild app
         with pytest.raises(Invalid) as cm:
             v.to_python(wh._id)
-        assert cm.exception.msg == 'Invalid webhook'
+        assert cm.value.msg == 'Invalid webhook'
 
         wh.app_config_id = app.config._id
         session(wh).flush(wh)