Ϫf ddlmZmZddlmZddlmZGddejZGddZ Gdd ejZ y ) )defererror)unittest) basesupportc*eZdZdZdZdZdZdZdZy) DummyAccountzO An account object that will do nothing when asked to start to log on. FcLtj|_|jS)z Set self.loginDeferred to the same as the deferred returned, allowing a testcase to .callback or .errback. @return: A deferred. )rDeferred loginDeferred)selfargss E/usr/lib/python3/dist-packages/twisted/words/test/test_basesupport.py _startLogOnzDummyAccount._startLogOns#^^-!!!cPd|_tjj||SNT)loginHasFailedrAbstractAccount _loginFailedr results rrzDummyAccount._loginFaileds#"**77fEErcPd|_tjj||Sr)loginCallbackCalledrr _cb_logOnrs rrzDummyAccount._cb_logOns##' **44T6BBrN) __name__ __module__ __qualname____doc__rrrrrrrrr s%N"FCrrceZdZdZdZdZy)DummyUIzT Provide just the interface required to be passed to AbstractAccount.logOn. Fcd|_yr)clientRegisteredrs rregisterAccountClientzDummyUI.registerAccountClient+s $rN)rrrrr#r$rrrr!r!$s%rr!c*eZdZdZdZdZdZdZy)ClientMsgTestsctS)N)r!r s rmakeUIzClientMsgTests.makeUI0s yrc"tddddddS)NlaF localhosti )rr(s r makeAccountzClientMsgTests.makeAccount3sD%t[$GGrcjj}j|}jj dfd}|j ||S)z Test that account.logOn works, and it calls the right callback when a connection is established. Ncvjjdjjdy)NzLogin shouldn't have failedzWe should be logged in) assertFalser assertTruer)raccountr s rcheckz*ClientMsgTests.test_connect..check@s/   W335R S OOG779Q Rr)r-r)logOnr callback addCallback)r uidr4r3s` @r test_connectzClientMsgTests.test_connect6sY ""$ [[] MM" &&t, S ercjjj}jj t fd}fd}|j |||S)r/cjjdjjdjj dy)NzLogin should have failedzWe shouldn't be logged inz(Client shouldn't be registered in the UI)r2rr1rr#)reasonr3r r8s rerrz.ClientMsgTests.test_failedConnect..errQsJ OOG224N O   W88:U V OO''')S rc(jddS)NFzShouldn't get called back)r2)rr s rz3ClientMsgTests.test_failedConnect..Xstu.IJr)r-r)r5r errback Exception addCallbacks)r r9r>cbr3r8s` @@rtest_failedConnectz!ClientMsgTests.test_failedConnectGsb ""$ [[] MM" %%ik2 K r3rc|j}|j}|j||jtj |j|y)ze Test that it can fail sensibly when someone tried to connect before we did. N)r-r)r5 assertRaisesr ConnectError)r r3r8s rtest_alreadyConnectingz%ClientMsgTests.test_alreadyConnecting\sE ""$ [[] b %,,gmmR@rN)rrrr)r-r:rFrJrrrr&r&/sH"*Arr&N) twisted.internetrr twisted.trialrtwisted.words.imrrrr!TestCaser&rrrrOsB*"(C;..C6%%5AX&&5Ar