From 668e721da79cc789334e706ef901d5339705f179 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Tue, 13 Nov 2018 22:22:55 -0600 Subject: [PATCH] Test __init__.py --- src/pgwui_logout/__init__.py | 4 ++- tests/test___init__.py | 51 ++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 tests/test___init__.py diff --git a/src/pgwui_logout/__init__.py b/src/pgwui_logout/__init__.py index 91278dc..85ab56a 100644 --- a/src/pgwui_logout/__init__.py +++ b/src/pgwui_logout/__init__.py @@ -22,9 +22,11 @@ '''Provide a way to configure PGWUI. ''' +DEFAULT_LOGOUT_ROUTE = '/logout' + def includeme(config): '''Pyramid configuration for PGWUI_Logout ''' - config.add_route('logout', '/logout') + config.add_route('logout', DEFAULT_LOGOUT_ROUTE) config.scan() diff --git a/tests/test___init__.py b/tests/test___init__.py new file mode 100644 index 0000000..a7af24b --- /dev/null +++ b/tests/test___init__.py @@ -0,0 +1,51 @@ +# Copyright (C) 2018 The Meme Factory, Inc. http://www.meme.com/ + +# This file is part of PGWUI_Logout. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License +# as published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +# + +# Karl O. Pinc + +import pyramid.config +from pyramid.threadlocal import get_current_request +import pgwui_logout.__init__ as pgwui_logout_init + + +# Activiate our pytest plugin +pytest_plugins = ("pgwui",) + + +# Functional tests + +# includeme() + +def test_includeme_functional(pyramid_request_config): + '''Sets a route for 'logout' + ''' + pgwui_logout_init.includeme(pyramid_request_config) + request = get_current_request() + + logout_path = request.route_path('logout') + assert logout_path == pgwui_logout_init.DEFAULT_LOGOUT_ROUTE + + +# Integration tests + +def test_includeme_integration(): + '''Does not blow up + ''' + config = pyramid.config.Configurator() + pgwui_logout_init.includeme(config) -- 2.34.1