diff options
| author | Michael Merickel <michael@merickel.org> | 2019-12-23 13:57:14 -0600 |
|---|---|---|
| committer | Michael Merickel <michael@merickel.org> | 2019-12-23 13:57:14 -0600 |
| commit | 570243fcf3f9bb7b3da78404b0598011791ac882 (patch) | |
| tree | be7a4176327b7745d4b21d329a8eebe04e5f68dd /tests/test_config | |
| parent | c52cfec057a9e22b794da655eac1708dfba8bef7 (diff) | |
| download | pyramid-570243fcf3f9bb7b3da78404b0598011791ac882.tar.gz pyramid-570243fcf3f9bb7b3da78404b0598011791ac882.tar.bz2 pyramid-570243fcf3f9bb7b3da78404b0598011791ac882.zip | |
add coverage tests for deprecation warnings
Diffstat (limited to 'tests/test_config')
| -rw-r--r-- | tests/test_config/test_routes.py | 11 | ||||
| -rw-r--r-- | tests/test_config/test_views.py | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_config/test_routes.py b/tests/test_config/test_routes.py index 4ff67cf66..423da5834 100644 --- a/tests/test_config/test_routes.py +++ b/tests/test_config/test_routes.py @@ -1,4 +1,5 @@ import unittest +import warnings from . import dummyfactory from . import DummyContext @@ -308,6 +309,16 @@ class RoutesConfiguratorMixinTests(unittest.TestCase): else: # pragma: no cover raise AssertionError + def test_add_route_effective_principals_deprecated(self): + config = self._makeOne(autocommit=True) + + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter('always', DeprecationWarning) + config.add_route('foo', '/bar', effective_principals=['any']) + self.assertIn( + 'removed the concept of principals', str(w[-1].message) + ) + class DummyRequest: subpath = () diff --git a/tests/test_config/test_views.py b/tests/test_config/test_views.py index d6b08c2f7..dcea02b1d 100644 --- a/tests/test_config/test_views.py +++ b/tests/test_config/test_views.py @@ -1,5 +1,6 @@ import os import unittest +import warnings from zope.interface import implementer from pyramid import testing @@ -2925,6 +2926,16 @@ class TestViewsConfigurationMixin(unittest.TestCase): weighs_more_than='text/plain;charset=utf8', ) + def test_effective_principals_deprecated(self): + config = self._makeOne(autocommit=True) + + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter('always', DeprecationWarning) + config.add_view(lambda: None, effective_principals=['any']) + self.assertIn( + 'removed the concept of principals', str(w[-1].message) + ) + class Test_runtime_exc_view(unittest.TestCase): def _makeOne(self, view1, view2): |
