'Test that the associated authenticator is correctly called.'

def test_authenticator(self):

    connectionMadeCalls = []
    streamStartedCalls = []
    associateWithStreamCalls = []
    class TestAuthenticator:
        def connectionMade(self):
            connectionMadeCalls.append(None)
        def streamStarted(self, rootElement):
            streamStartedCalls.append(rootElement)
        def associateWithStream(self, xs):
            associateWithStreamCalls.append(xs)
    a = TestAuthenticator()
    xs = xmlstream.XmlStream(a)
    self.assertEqual([xs], associateWithStreamCalls)
    xs.connectionMade()
    self.assertEqual([None], connectionMadeCalls)
    xs.dataReceived("<stream:stream    xmlns='jabber:client'    xmlns:stream='http://etherx.jabber.org/streams'    from='example.com'    id='12345'>")
    self.assertEqual(1, len(streamStartedCalls))
    xs.reset()
    self.assertEqual([None], connectionMadeCalls)
