Commits

Éric Araujo committed 6a69f3e

* Move config.scan call to make this work :)

Comments (0)

Files changed (2)

pyramid_restlogging/__init__.py

         '/logs/{logger_name:[\d\w\.]+}/{log_level:debug|info|warning|error|critical}',
         request_method='POST',
         )
+    config.scan('pyramid_restlogging.views')
+    config.commit()
 
 
 def main(global_config, **settings):
     # XXX global_config is ignored?
     config = Configurator(settings=settings)
     config.include(includeme)
-    config.scan()
     return config.make_wsgi_app()

pyramid_restlogging/tests/test_unit.py

 # -*- coding: utf-8 -*-
 import unittest
 
+import mock
 from pyramid.testing import DummyRequest
 
 
+class TestIncludeme(unittest.TestCase):
+
+    def test_basic(self):
+        from pyramid_restlogging import includeme
+        config = mock.Mock()
+
+        includeme(config)
+
+        config.add_route.assert_called_with('logs', mock.ANY,
+                                            request_method='POST')
+        config.scan.assert_called_with('pyramid_restlogging.views')
+        config.commit.assert_called_with()
+
+
 class TestLogView(unittest.TestCase):
 
     def test_nominal_case(self):