Test __init__.py
authorKarl O. Pinc <kop@meme.com>
Wed, 14 Nov 2018 04:22:55 +0000 (22:22 -0600)
committerKarl O. Pinc <kop@meme.com>
Wed, 14 Nov 2018 04:22:55 +0000 (22:22 -0600)
src/pgwui_logout/__init__.py
tests/test___init__.py [new file with mode: 0644]

index 91278dcda1ae893ebfeb321d3455cfad5f09a2c0..85ab56a1a77038dd82dcb0d098a983f54fdafa19 100644 (file)
 '''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 (file)
index 0000000..a7af24b
--- /dev/null
@@ -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
+# <http://www.gnu.org/licenses/>.
+#
+
+# Karl O. Pinc <kop@meme.com>
+
+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)