Commits

Anonymous committed e245c14

* Removed main as pyramid_facebook cannot be used standalone.

Comments (0)

Files changed (3)

pyramid_facebook/__init__.py

 
 __all__ = [
     'includeme',
-    'main',
+    'facebook_canvas'
     'facebook_payments_get_items',
-    'facebook_canvas'
     ]
 
 log = logging.getLogger(__name__)
 
 
-def main(global_config, **settings):
-    # I should remove this and construct app in functional test
-    log.debug('global_config: %r\nsettings: %r', global_config, settings)
-    config = Configurator(settings=settings)
-    config.include(includeme)
-    return config.make_wsgi_app()
-
-
 def includeme(config):
     """Undirectly executed when including ``pyramid_facebook`` using
     :meth:`config.include <pyramid.config.Configurator.include>`

pyramid_facebook/tests/functionals/__init__.py

 import unittest
 import webtest
 
+from pyramid.config import Configurator
+
+
 class TestController(unittest.TestCase):
 
     _app = None
     @property
     def app(self):
         if TestController._app is None:
-            from pyramid_facebook import main
+            from pyramid_facebook import includeme
             from ...tests import conf
-            TestController._app = webtest.TestApp(main(None, **conf))
+            config = Configurator(settings=conf)
+            config.include(includeme)
+            TestController._app = webtest.TestApp(config.make_wsgi_app())
         return TestController._app
 

pyramid_facebook/tests/unittests/test_pyramid_facebook.py

 
 class TestPyramidFacebook(unittest.TestCase):
 
-    @mock.patch('pyramid_facebook.Configurator')
-    def test_main(self, m_Configurator):
-        settings = {
-            'facebook.namespace': 'namespace'
-        }
-
-        from pyramid_facebook import main, includeme
-        result = main(None, **settings)
-
-        m_Configurator.assert_called_once_with(settings=settings)
-        m_Configurator.return_value.include.assert_called_once_with(includeme)
-        m_Configurator.return_value.make_wsgi_app.assert_called_once_with()
-
-        self.assertEqual(
-            m_Configurator.return_value.make_wsgi_app.return_value,
-            result
-            )
-
     @mock.patch('pyramid_facebook.request_params_predicate')
     @mock.patch('pyramid_facebook.FacebookAuthenticationPolicy')
     @mock.patch('pyramid_facebook.ACLAuthorizationPolicy')