예제 #1
0
class TestPluginModuleRoutes(TestCase):
    def setUp(self):
        self.plugin = Plugin('My Plugin', 'my.plugin.id')
        self.module = Module('mymodule')

    def test_routes(self):
        @self.module.route('/')
        def mock_view():
            return 'foo'

        @self.plugin.route('/')
        def mock_view2():
            return 'bar'

        self.plugin.register_module(self.module, '/module')

        self.assertEqual(self.plugin.dispatch('/'), 'bar')
        self.assertEqual(self.plugin.dispatch('/module/'), 'foo')
        self.assertEqual(self.plugin.url_for('mock_view2'),
                         'special://my.plugin.id/')
        self.assertEqual(self.plugin.url_for('mymodule.mock_view'),
                         'special://my.plugin.id/module/')
        self.assertEqual(self.module.url_for('mock_view'),
                         'special://my.plugin.id/module/')
        print 'here?'
예제 #2
0
class TestPluginModuleRoutes(TestCase):
    def setUp(self):
        self.plugin = Plugin("My Plugin", "my.plugin.id")
        self.module = Module("mymodule")

    def test_routes(self):
        @self.module.route("/")
        def mock_view():
            return "foo"

        @self.plugin.route("/")
        def mock_view2():
            return "bar"

        self.plugin.register_module(self.module, "/module")

        self.assertEqual(self.plugin.dispatch("/"), "bar")
        self.assertEqual(self.plugin.dispatch("/module/"), "foo")
        self.assertEqual(self.plugin.url_for("mock_view2"), "special://my.plugin.id/")
        self.assertEqual(self.plugin.url_for("mymodule.mock_view"), "special://my.plugin.id/module/")
        self.assertEqual(self.module.url_for("mock_view"), "special://my.plugin.id/module/")
        print "here?"
예제 #3
0
 def setUp(self):
     self.plugin = Plugin('My Plugin', 'my.plugin.id')
     self.module = Module('mymodule')
예제 #4
0
 def setUp(self):
     self.plugin = Plugin("My Plugin", "my.plugin.id")
     self.module = Module("mymodule")