'Test routing of a message.'

def test_route(self):

    component1 = XmlPipe()
    component2 = XmlPipe()
    router = component.Router()
    router.addRoute('component1.example.org', component1.sink)
    router.addRoute('component2.example.org', component2.sink)
    outgoing = []
    component2.source.addObserver('/*', (lambda element: outgoing.append(element)))
    stanza = domish.Element((None, 'presence'))
    stanza['from'] = 'component1.example.org'
    stanza['to'] = 'component2.example.org'
    component1.source.send(stanza)
    self.assertEqual([stanza], outgoing)
