Move code out of __init__.py
authorKarl O. Pinc <kop@karlpinc.com>
Sun, 15 Nov 2020 23:17:30 +0000 (17:17 -0600)
committerKarl O. Pinc <kop@karlpinc.com>
Sun, 15 Nov 2020 23:17:30 +0000 (17:17 -0600)
src/pgwui_logout/__init__.py
src/pgwui_logout/pgwui_logout.py [new file with mode: 0644]
tests/test___init__.py [deleted file]
tests/test_pgwui_logout.py [new file with mode: 0644]

index ef06bd3236d45aabb5a059c68308a3eafa9069e3..f7a090958d33f81b59b259532554f1a12df47da5 100644 (file)
 
 # Karl O. Pinc <kop@meme.com>
 
-'''Provide a way to configure PGWUI.
-'''
-
-PGWUI_COMPONENT = 'pgwui_logout'
-DEFAULT_LOGOUT_ROUTE = '/logout'
-DEFAULT_LOGOUT_MENU_LABEL = 'logout -- Logout from PGWUI programs'
-
-
-def init_menu(config):
-    '''Add default menu information into settings when they are not present
-    '''
-    settings = config.get_settings()
-    pgwui = settings.setdefault('pgwui', dict())
-    pgwui.setdefault(PGWUI_COMPONENT, dict())
-    pgwui[PGWUI_COMPONENT].setdefault(
-        'menu_label', DEFAULT_LOGOUT_MENU_LABEL)
-
-
-def includeme(config):
-    '''Pyramid configuration for PGWUI_Logout
-    '''
-    init_menu(config)
-    config.add_route(PGWUI_COMPONENT, DEFAULT_LOGOUT_ROUTE)
-    config.scan()
+from .pgwui_logout import includeme        # noqa: F401
diff --git a/src/pgwui_logout/pgwui_logout.py b/src/pgwui_logout/pgwui_logout.py
new file mode 100644 (file)
index 0000000..ef06bd3
--- /dev/null
@@ -0,0 +1,45 @@
+# 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>
+
+'''Provide a way to configure PGWUI.
+'''
+
+PGWUI_COMPONENT = 'pgwui_logout'
+DEFAULT_LOGOUT_ROUTE = '/logout'
+DEFAULT_LOGOUT_MENU_LABEL = 'logout -- Logout from PGWUI programs'
+
+
+def init_menu(config):
+    '''Add default menu information into settings when they are not present
+    '''
+    settings = config.get_settings()
+    pgwui = settings.setdefault('pgwui', dict())
+    pgwui.setdefault(PGWUI_COMPONENT, dict())
+    pgwui[PGWUI_COMPONENT].setdefault(
+        'menu_label', DEFAULT_LOGOUT_MENU_LABEL)
+
+
+def includeme(config):
+    '''Pyramid configuration for PGWUI_Logout
+    '''
+    init_menu(config)
+    config.add_route(PGWUI_COMPONENT, DEFAULT_LOGOUT_ROUTE)
+    config.scan()
diff --git a/tests/test___init__.py b/tests/test___init__.py
deleted file mode 100644 (file)
index 66b9afb..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-# Copyright (C) 2018, 2019, 2020 The Meme Factory, Inc.
-# http://www.karlpinc.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@karlpinc.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",)
-
-
-# Module packaging test
-
-def test_pgwui_upload_is_pgwui_component(pgwui_component_entry_point):
-    '''Ensure that pgwui_upload is a pgwui.component entry point
-    '''
-    assert pgwui_component_entry_point('pgwui_logout') is True
-
-
-# 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('pgwui_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)
diff --git a/tests/test_pgwui_logout.py b/tests/test_pgwui_logout.py
new file mode 100644 (file)
index 0000000..381d378
--- /dev/null
@@ -0,0 +1,60 @@
+# Copyright (C) 2018, 2019, 2020 The Meme Factory, Inc.
+# http://www.karlpinc.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@karlpinc.com>
+
+import pyramid.config
+from pyramid.threadlocal import get_current_request
+import pgwui_logout.pgwui_logout as pgwui_logout
+
+
+# Activiate our pytest plugin
+pytest_plugins = ("pgwui",)
+
+
+# Module packaging test
+
+def test_pgwui_upload_is_pgwui_component(pgwui_component_entry_point):
+    '''Ensure that pgwui_upload is a pgwui.component entry point
+    '''
+    assert pgwui_component_entry_point('pgwui_logout') is True
+
+
+# Functional tests
+
+# includeme()
+
+def test_includeme_functional(pyramid_request_config):
+    '''Sets a route for 'logout'
+    '''
+    pgwui_logout.includeme(pyramid_request_config)
+    request = get_current_request()
+
+    logout_path = request.route_path('pgwui_logout')
+    assert logout_path == pgwui_logout.DEFAULT_LOGOUT_ROUTE
+
+
+# Integration tests
+
+def test_includeme_integration():
+    '''Does not blow up
+    '''
+    config = pyramid.config.Configurator()
+    pgwui_logout.includeme(config)