Ejemplo n.º 1
0
    def test_dispatch_default(self):
        serializer = wsgi.ActionDispatcher()
        serializer.create = lambda x: x + ' pants'
        serializer.default = lambda x: x + ' trousers'

        self.assertEqual(serializer.dispatch('Two', action='update'),
                         'Two trousers')
Ejemplo n.º 2
0
    def test_dispatch(self):
        """Test ActionDispatcher.dispatch."""
        serializer = wsgi.ActionDispatcher()
        serializer.create = lambda x: x

        self.assertEqual(serializer.dispatch('pants', action='create'),
                         'pants')
Ejemplo n.º 3
0
    def test_dispatch_action_None(self):
        """Test ActionDispatcher.dispatch with none action."""
        serializer = wsgi.ActionDispatcher()
        serializer.create = lambda x: x + ' pants'
        serializer.default = lambda x: x + ' trousers'

        self.assertEqual(serializer.dispatch('Two', action=None),
                         'Two trousers')