'Test route registration and routing on incoming stanzas.'

def test_addRoute(self):

    router = component.Router()
    routed = []
    router.route = (lambda element: routed.append(element))
    pipe = XmlPipe()
    router.addRoute('example.org', pipe.sink)
    self.assertEqual(1, len(router.routes))
    self.assertEqual(pipe.sink, router.routes['example.org'])
    element = domish.Element(('testns', 'test'))
    pipe.source.send(element)
    self.assertEqual([element], routed)
