def test_chat_closechat_exit(): cshell = CryptoShell('main.cfg') cshell.test_mode = True eq_(cshell.do_chat(''), False) eq_(cshell.do_chat('*****@*****.**'), True) eq_(cshell.do_chat('cryptoim'), True) eq_(cshell.do_chat('shouldntwork'), False) eq_(cshell.do_connect('cryptoim2'), True) TestXMPP.waitForSession(cshell.messenger, True) eq_(cshell.do_send('Test message'), True) eq_(cshell.do_s('Test message for short version'), True) eq_(cshell.do_send(''), False) eq_(cshell.do_closechat(''), True) eq_(cshell.do_closechat(''), False) eq_(cshell.do_send('Test message after stopchat'), False) eq_(cshell.do_s('Alsto testing the short version'), False) cshell.do_disconnect('') exit_code = -1 try: cshell.do_exit('') except SystemExit: exit_code = 0 eq_(0, exit_code)
def test_send(): cshell = CryptoShell('main.cfg') cshell.test_mode = True eq_(cshell.do_send('cryptoim message before connection'), False) eq_(cshell.do_connect('cryptoim2'), True) TestXMPP.waitForSession(cshell.messenger, True) eq_(cshell.do_send(''), False) eq_(cshell.onecmd(''), None) # just empty line command - emptyline() test eq_(cshell.do_send('shouldntwork message'), False) eq_(cshell.do_send('cryptoim message'), True) eq_(cshell.do_send('[email protected] message'), True) eq_(cshell.do_send('cryptoim'), False) cshell.do_disconnect('')