diff --git a/ckanext/pages/tests/test_logic.py b/ckanext/pages/tests/test_logic.py index 1642cba..015d76d 100644 --- a/ckanext/pages/tests/test_logic.py +++ b/ckanext/pages/tests/test_logic.py @@ -241,11 +241,17 @@ def test_revisions_page(self, app): assert '404 Not Found' in response.body - response = app.get( - toolkit.url_for('pages.pages_revisions', page="page_name"), - status=401) - - assert '

401 Unauthorized

' in response.body + if toolkit.check_ckan_version(min_version="2.10.0"): + response = app.get( + toolkit.url_for('pages.pages_revisions', page="page_name"), + status=401) + + assert '

401 Unauthorized

' in response.body + else: + response = app.get( + toolkit.url_for('pages.pages_revisions', page="page_name") + ) + assert '

Login

' in response.body def test_revision_preview_page(self, app): user = factories.Sysadmin() @@ -281,14 +287,23 @@ def test_revision_preview_page(self, app): assert '404 Not Found' in response.body - response = app.get( - toolkit.url_for( - 'pages.pages_revisions_preview', - page="page_name", - revision=revision_id), - status=401) - - assert '

401 Unauthorized

' in response.body + if toolkit.check_ckan_version(min_version="2.10.0"): + response = app.get( + toolkit.url_for( + 'pages.pages_revisions_preview', + page="page_name", + revision=revision_id), + status=401) + + assert '

401 Unauthorized

' in response.body + else: + response = app.get( + toolkit.url_for( + 'pages.pages_revisions_preview', + page="page_name", + revision=revision_id), + ) + assert '

Login

' in response.body def test_revision_restore_page(self, app): user = factories.Sysadmin() @@ -343,14 +358,24 @@ def test_revision_restore_page(self, app): assert 'Bad values, please make sure that provided values exist' in response.body - response = app.get( - toolkit.url_for( - 'pages.pages_revision_restore', - page="page_name", - revision=last_revision[0]), - status=401) + if toolkit.check_ckan_version(min_version="2.10.0"): + response = app.get( + toolkit.url_for( + 'pages.pages_revision_restore', + page="page_name", + revision=last_revision[0]), + status=401) + + assert '

401 Unauthorized

' in response.body + else: + response = app.get( + toolkit.url_for( + 'pages.pages_revision_restore', + page="page_name", + revision=last_revision[0]), + ) - assert '

401 Unauthorized

' in response.body + assert '

Login

' in response.body def test_revisions_blog(self, app): user = factories.Sysadmin() @@ -378,11 +403,18 @@ def test_revisions_blog(self, app): assert '404 Not Found' in response.body - response = app.get( - toolkit.url_for('pages.blog_revisions', page="blog_name"), - status=401) + if toolkit.check_ckan_version(min_version="2.10.0"): + response = app.get( + toolkit.url_for('pages.blog_revisions', page="blog_name"), + status=401) - assert '

401 Unauthorized

' in response.body + assert '

401 Unauthorized

' in response.body + else: + response = app.get( + toolkit.url_for('pages.blog_revisions', page="blog_name"), + ) + + assert '

Login

' in response.body def test_revision_preview_blog(self, app): user = factories.Sysadmin() @@ -420,14 +452,23 @@ def test_revision_preview_blog(self, app): assert '404 Not Found' in response.body - response = app.get( - toolkit.url_for( - 'pages.blog_revisions_preview', - page="blog_name", - revision=revision_id), - status=401) - - assert '

401 Unauthorized

' in response.body + if toolkit.check_ckan_version(min_version="2.10.0"): + response = app.get( + toolkit.url_for( + 'pages.blog_revisions_preview', + page="blog_name", + revision=revision_id), + status=401) + + assert '

401 Unauthorized

' in response.body + else: + response = app.get( + toolkit.url_for( + 'pages.blog_revisions_preview', + page="blog_name", + revision=revision_id), + ) + assert '

Login

' in response.body def test_revision_restore_blog(self, app): user = factories.Sysadmin() @@ -487,11 +528,21 @@ def test_revision_restore_blog(self, app): assert 'Bad values, please make sure that provided values exist' in response.body - response = app.get( - toolkit.url_for( - 'pages.blog_revision_restore', - page="blog_name", - revision=last_revision[0]), - status=401) + if toolkit.check_ckan_version(min_version="2.10.0"): + response = app.get( + toolkit.url_for( + 'pages.blog_revision_restore', + page="blog_name", + revision=last_revision[0]), + status=401) + + assert '

401 Unauthorized

' in response.body + else: + response = app.get( + toolkit.url_for( + 'pages.blog_revision_restore', + page="blog_name", + revision=last_revision[0]), + ) - assert '

401 Unauthorized

' in response.body + assert '

Login

' in response.body