Ejemplo n.º 1
0
    def test_html_escape_policy(self):
        sys.modules['weechat'].config_options[
            'otr.policy.server.nick.friend.html_escape'] = 'on'

        result = weechat_otr.message_out_cb(None, None, 'server',
            ':nick!user@host PRIVMSG friend :< > " \' &')
        self.assertEqual(result, 'PRIVMSG friend :&lt; &gt; " \' &amp;')
    def test_html_escape_policy_off_unencrypted(self):
        sys.modules['weechat'].config_options[
            'otr.policy.server.nick.friend.html_escape'] = 'off'
        self.account.getContext('friend@server').is_encrypted_fake = False

        result = weechat_otr.message_out_cb(
            None, None, 'server', ':nick!user@host PRIVMSG friend :< > " \' &')
        self.assertEqual(result, 'PRIVMSG friend :< > " \' &')
Ejemplo n.º 3
0
    def test_message_out_cb_send_tag_ctcp(self):
        sys.modules['weechat'].config_options[
            'otr.policy.default.send_tag'] = 'on'

        result = weechat_otr.message_out_cb(None, None, 'server',
            ':nick!user@host PRIVMSG friend :\x01CTCP VERSION\x01')
        self.assertEqual(weechat_otr.PYVER.to_unicode(result),
            'PRIVMSG friend :\x01CTCP VERSION\x01')
Ejemplo n.º 4
0
    def test_message_out_cb_send_tag_non_ascii(self):
        sys.modules['weechat'].config_options[
            'otr.policy.server.nick.friend.send_tag'] = 'on'

        result = weechat_otr.message_out_cb(None, None, 'server',
            ":nick!user@host PRIVMSG friend :\xc3")
        self.assertEqual(weechat_otr.PYVER.to_unicode(result),
            "PRIVMSG friend :\xc3 \t  \t\t\t\t \t \t \t    \t\t  \t \t")
Ejemplo n.º 5
0
    def test_message_out_cb_send_tag_chanserv(self):
        sys.modules['weechat'].config_options[
            'otr.policy.default.send_tag'] = 'on'

        result = weechat_otr.message_out_cb(None, None, 'server',
            ':nick!user@host PRIVMSG ChanServ :register channel secret desc')
        self.assertEqual(weechat_otr.PYVER.to_unicode(result),
            'PRIVMSG ChanServ :register channel secret desc')
Ejemplo n.º 6
0
    def test_html_escape_policy_non_ascii(self):
        sys.modules["weechat"].config_options[
            weechat_otr.PYVER.to_str("otr.policy.server.nick.gefährte.html_escape")
        ] = "on"
        self.account.getContext("gefährte@server").is_encrypted_fake = True

        result = weechat_otr.message_out_cb(None, None, "server", ":nick!user@host PRIVMSG gefährte :< > \" ' &")
        self.assertEqual(result, weechat_otr.PYVER.to_str("PRIVMSG gefährte :&lt; &gt; \" ' &amp;"))
Ejemplo n.º 7
0
    def test_message_out_cb_send_tag_memoserv(self):
        sys.modules['weechat'].config_options[
            'otr.policy.default.send_tag'] = 'on'

        result = weechat_otr.message_out_cb(None, None, 'server',
            ':nick!user@host PRIVMSG MemoServ :send friend hi')
        self.assertEqual(weechat_otr.PYVER.to_unicode(result),
            'PRIVMSG MemoServ :send friend hi')
Ejemplo n.º 8
0
    def test_message_out_cb_send_tag_nickserv(self):
        sys.modules['weechat'].config_options[
            'otr.policy.default.send_tag'] = 'on'

        result = weechat_otr.message_out_cb(None, None, 'server',
            ":nick!user@host PRIVMSG NickServ :identify secret")
        self.assertEqual(weechat_otr.PYVER.to_unicode(result),
            "PRIVMSG NickServ :identify secret")
Ejemplo n.º 9
0
    def test_html_escape_policy_non_ascii(self):
        sys.modules['weechat'].config_options[
            'otr.policy.server.nick.gefährte.html_escape'] = 'on'

        result = weechat_otr.message_out_cb(None, None, 'server',
            ':nick!user@host PRIVMSG gefährte :< > " \' &')
        self.assertEqual(result, weechat_otr.PYVER.to_str(
            'PRIVMSG gefährte :&lt; &gt; " \' &amp;'))
Ejemplo n.º 10
0
    def test_html_escape_policy_off_unencrypted(self):
        sys.modules['weechat'].config_options[
            'otr.policy.server.nick.friend.html_escape'] = 'off'
        self.account.getContext('friend@server').is_encrypted_fake = False

        result = weechat_otr.message_out_cb(None, None, 'server',
            ':nick!user@host PRIVMSG friend :< > " \' &')
        self.assertEqual(result, 'PRIVMSG friend :< > " \' &')
Ejemplo n.º 11
0
    def test_otr_disabled_require_encryption(self):
        sys.modules['weechat'].config_options.update({
            'otr.policy.default.allow_v2' : 'off',
            'otr.policy.default.require_encryption' : 'on'
        })

        weechat_otr.message_out_cb(None, None, 'server',
            ':nick!user@host PRIVMSG nick2 :hello')

        self.assertNotPrinted('server_nick2_buffer',
            'eval(${color:default}:! ${color:brown}otr${color:default} !:)\t'
            '(color lightred)Your message will not be sent, because policy '
            'requires an encrypted connection.')
        self.assertNotPrinted('server_nick2_buffer',
            'eval(${color:default}:! ${color:brown}otr${color:default} !:)\t'
            '(color lightblue)Wait for the OTR connection or change the '
            'policy to allow clear-text messages:\r\n(color '
            'lightblue)/policy set require_encryption off')
Ejemplo n.º 12
0
    def test_require_encryption(self):
        sys.modules['weechat'].config_options.update(
            {'otr.policy.default.require_encryption': 'on'})

        weechat_otr.message_out_cb(None, None, 'server',
                                   ':nick!user@host PRIVMSG nick2 :hello')

        self.assertPrinted(
            'server_nick2_buffer',
            'eval(${color:default}:! ${color:brown}otr${color:default} !:)\t'
            '(color lightred)Your message will not be sent, because policy '
            'requires an encrypted connection.')
        self.assertPrinted(
            'server_nick2_buffer',
            'eval(${color:default}:! ${color:brown}otr${color:default} !:)\t'
            '(color lightblue)Wait for the OTR connection or change the '
            'policy to allow clear-text messages:\r\n(color '
            'lightblue)/otr policy require_encryption off')
Ejemplo n.º 13
0
    def test_message_out_cb_send_tag_ctcp(self):
        sys.modules['weechat'].config_options[
            'otr.policy.default.send_tag'] = 'on'

        result = weechat_otr.message_out_cb(
            None, None, 'server',
            ':nick!user@host PRIVMSG friend :\x01CTCP VERSION\x01')
        self.assertEqual(weechat_otr.PYVER.to_unicode(result),
                         'PRIVMSG friend :\x01CTCP VERSION\x01')
Ejemplo n.º 14
0
    def test_message_out_cb_send_tag_non_ascii(self):
        sys.modules['weechat'].config_options[
            'otr.policy.server.nick.friend.send_tag'] = 'on'

        result = weechat_otr.message_out_cb(
            None, None, 'server', ":nick!user@host PRIVMSG friend :\xc3")
        self.assertEqual(
            weechat_otr.PYVER.to_unicode(result),
            "PRIVMSG friend :\xc3 \t  \t\t\t\t \t \t \t    \t\t  \t \t")
Ejemplo n.º 15
0
    def test_exception_raised_prints_versions(self):
        sys.modules['weechat'].info_get_hashtable_raise = Exception('test')
        sys.modules['weechat'].infos[('', )]['version'] = '9.8.7'

        version_str = (
            'Versions: weechat-otr {script_version}, '
            'potr {potr_major}.{potr_minor}.{potr_patch}-{potr_sub}, '
            'Python {python_version}, '
            'WeeChat 9.8.7').format(script_version=weechat_otr.SCRIPT_VERSION,
                                    potr_major=potr.VERSION[0],
                                    potr_minor=potr.VERSION[1],
                                    potr_patch=potr.VERSION[2],
                                    potr_sub=potr.VERSION[3],
                                    python_version=platform.python_version())

        weechat_otr.message_out_cb(None, None, 'server',
                                   ':nick!user@host PRIVMSG nick2 :hello')
        self.assertPrintedContains('', version_str)
Ejemplo n.º 16
0
    def assertNickIsNotTagged(self, nick):
        sys.modules['weechat'].config_options[
            'otr.policy.default.send_tag'] = 'on'

        result = weechat_otr.message_out_cb(None, None, 'server',
            weechat_otr.PYVER.to_str(
            ':nick!user@host PRIVMSG {nick} :send friend hi'.format(
            nick=nick)))
        self.assertEqual(weechat_otr.PYVER.to_unicode(result),
            'PRIVMSG {nick} :send friend hi'.format(nick=nick))
Ejemplo n.º 17
0
    def test_html_escape_policy_non_ascii(self):
        sys.modules['weechat'].config_options[weechat_otr.PYVER.to_str(
            'otr.policy.server.nick.gefährte.html_escape')] = 'on'
        self.account.getContext('gefährte@server').is_encrypted_fake = True

        result = weechat_otr.message_out_cb(
            None, None, 'server',
            ':nick!user@host PRIVMSG gefährte :< > " \' &')
        self.assertEqual(result, weechat_otr.PYVER.to_str(
            'PRIVMSG gefährte :&lt; &gt; " \' &amp;'))
Ejemplo n.º 18
0
    def test_otr_change_my_nick_case(self):
        sys.modules['weechat'].set_server_current_nick('server', 'nick')

        account1 = weechat_otr_test.recording_account.RecordingAccount(
            'nick@server')
        weechat_otr.ACCOUNTS['nick@server'] = account1

        account2 = weechat_otr_test.recording_account.RecordingAccount(
            'nick2@server')
        weechat_otr.ACCOUNTS['nick2@server'] = account2

        context1 = account2.getContext('nick@server')
        context2 = account1.getContext('nick2@server')

        weechat_otr.message_in_cb(
            None, None, 'server', ':nick2!user@host PRIVMSG nick :?OTRv2?')

        sys.modules['weechat'].set_server_current_nick('server', 'nick2')
        self.send_all('nick', 'nick2', context2.injected)

        sys.modules['weechat'].set_server_current_nick('server', 'nick')
        self.send_all('nick2', 'nick', context1.injected)

        sys.modules['weechat'].set_server_current_nick('server', 'nick2')
        self.send_all('nick', 'nick2', context2.injected)

        sys.modules['weechat'].set_server_current_nick('server', 'nick')
        self.send_all('nick2', 'nick', context1.injected)

        self.assertTrue(context1.is_encrypted())
        self.assertTrue(context2.is_encrypted())

        sys.modules['weechat'].set_server_current_nick('server', 'NiCk')
        weechat_otr.message_out_cb(
            None, None, 'server', ':NiCk!user@host PRIVMSG nick2 :hi')

        sys.modules['weechat'].set_server_current_nick('server', 'nick2')

        result = weechat_otr.message_in_cb(
            None, None, 'server',
            ':NiCk!user@host PRIVMSG nick2 :%s' % context2.injected.pop())

        self.assertEqual(result, ':NiCk!user@host PRIVMSG nick2 :hi')
Ejemplo n.º 19
0
    def test_message_out_cb_empty_no_send_tag_regex(self):
        sys.modules['weechat'].config_options[
            'otr.policy.default.send_tag'] = 'on'
        sys.modules['weechat'].config_options[
            'otr.general.no_send_tag_regex'] = weechat_otr.PYVER.to_str('')

        result = weechat_otr.message_out_cb(None, None, 'server',
            weechat_otr.PYVER.to_str(":nick!user@host PRIVMSG friend :hi"))
        self.assertEqual(weechat_otr.PYVER.to_unicode(result),
            "PRIVMSG friend :hi \t  \t\t\t\t \t \t \t    \t\t  \t \t")
Ejemplo n.º 20
0
    def test_otr_change_my_nick_case(self):
        sys.modules['weechat'].set_server_current_nick('server', 'nick')

        account1 = weechat_otr_test.recording_account.RecordingAccount(
            'nick@server')
        weechat_otr.ACCOUNTS['nick@server'] = account1

        account2 = weechat_otr_test.recording_account.RecordingAccount(
            'nick2@server')
        weechat_otr.ACCOUNTS['nick2@server'] = account2

        context1 = account2.getContext('nick@server')
        context2 = account1.getContext('nick2@server')

        weechat_otr.message_in_cb(None, None, 'server',
                                  ':nick2!user@host PRIVMSG nick :?OTRv2?')

        sys.modules['weechat'].set_server_current_nick('server', 'nick2')
        self.send_all('nick', 'nick2', context2.injected)

        sys.modules['weechat'].set_server_current_nick('server', 'nick')
        self.send_all('nick2', 'nick', context1.injected)

        sys.modules['weechat'].set_server_current_nick('server', 'nick2')
        self.send_all('nick', 'nick2', context2.injected)

        sys.modules['weechat'].set_server_current_nick('server', 'nick')
        self.send_all('nick2', 'nick', context1.injected)

        self.assertTrue(context1.is_encrypted())
        self.assertTrue(context2.is_encrypted())

        sys.modules['weechat'].set_server_current_nick('server', 'NiCk')
        weechat_otr.message_out_cb(None, None, 'server',
                                   ':NiCk!user@host PRIVMSG nick2 :hi')

        sys.modules['weechat'].set_server_current_nick('server', 'nick2')

        result = weechat_otr.message_in_cb(
            None, None, 'server',
            ':NiCk!user@host PRIVMSG nick2 :%s' % context2.injected.pop())

        self.assertEqual(result, ':NiCk!user@host PRIVMSG nick2 :hi')
Ejemplo n.º 21
0
    def assertNickIsNotTagged(self, nick):
        sys.modules['weechat'].config_options[
            'otr.policy.default.send_tag'] = 'on'

        result = weechat_otr.message_out_cb(
            None, None, 'server',
            weechat_otr.PYVER.to_str(
                ':nick!user@host PRIVMSG {nick} :send friend hi'.format(
                    nick=nick)))
        self.assertEqual(weechat_otr.PYVER.to_unicode(result),
                         'PRIVMSG {nick} :send friend hi'.format(nick=nick))
    def test_html_escape_policy_non_ascii(self):
        sys.modules['weechat'].config_options[weechat_otr.PYVER.to_str(
            'otr.policy.server.nick.gefährte.html_escape')] = 'on'
        self.account.getContext('gefährte@server').is_encrypted_fake = True

        result = weechat_otr.message_out_cb(
            None, None, 'server',
            ':nick!user@host PRIVMSG gefährte :< > " \' &')
        self.assertEqual(
            result,
            weechat_otr.PYVER.to_str('PRIVMSG gefährte :&lt; &gt; " \' &amp;'))
Ejemplo n.º 23
0
    def test_exception_raised_prints_versions(self):
        sys.modules['weechat'].info_get_hashtable_raise = Exception('test')
        sys.modules['weechat'].infos[('',)]['version'] = '9.8.7'

        version_str = (
            'Versions: weechat-otr {script_version}, '
            'potr {potr_major}.{potr_minor}.{potr_patch}-{potr_sub}, '
            'Python {python_version}, '
            'WeeChat 9.8.7'
            ).format(
            script_version=weechat_otr.SCRIPT_VERSION,
            potr_major=potr.VERSION[0],
            potr_minor=potr.VERSION[1],
            potr_patch=potr.VERSION[2],
            potr_sub=potr.VERSION[3],
            python_version=platform.python_version())

        weechat_otr.message_out_cb(None, None, 'server',
            ':nick!user@host PRIVMSG nick2 :hello')
        self.assertPrintedContains('', version_str)
Ejemplo n.º 24
0
    def test_message_out_cb_empty_no_send_tag_regex(self):
        sys.modules['weechat'].config_options[
            'otr.policy.default.send_tag'] = 'on'
        sys.modules['weechat'].config_options[
            'otr.general.no_send_tag_regex'] = weechat_otr.PYVER.to_str('')

        result = weechat_otr.message_out_cb(
            None, None, 'server',
            weechat_otr.PYVER.to_str(":nick!user@host PRIVMSG friend :hi"))
        self.assertEqual(
            weechat_otr.PYVER.to_unicode(result),
            "PRIVMSG friend :hi \t  \t\t\t\t \t \t \t    \t\t  \t \t")
Ejemplo n.º 25
0
 def test_message_out_cb_nick_with_at(self):
     result = weechat_otr.message_out_cb(
         None, None, 'server', ':nick!user@host PRIVMSG @#chan :hello')
     self.assertEqual(result, ':nick!user@host PRIVMSG @#chan :hello')
Ejemplo n.º 26
0
    def test_otr_session_non_ascii(self):
        sys.modules['weechat'].set_server_current_nick('server', 'gefährte')
        sys.modules['weechat'].infos.update({
            (weechat_otr.PYVER.to_str('server,gefährte'), ): {
                'irc_buffer': 'server_gefährte_buffer'
            },
            (weechat_otr.PYVER.to_str('server,gefährte2'), ): {
                'irc_buffer': 'server_gefährte2_buffer'
            },
        })
        sys.modules['weechat'].buffers.update({
            weechat_otr.PYVER.to_str('server_gefährte_buffer'): {
                'localvar_type': 'private',
                'localvar_channel': 'gefährte',
                'localvar_server': 'server',
                'name': 'server_gefährte_buffer_name',
                'plugin': 'irc',
            },
            weechat_otr.PYVER.to_str('server_gefährte2_buffer'): {
                'localvar_type': 'private',
                'localvar_channel': 'gefährte2',
                'localvar_server': 'server',
                'name': 'server_gefährte2_buffer_name',
                'plugin': 'irc',
            },
        })

        account1 = weechat_otr_test.recording_account.RecordingAccount(
            'gefährte@server')
        weechat_otr.ACCOUNTS['gefährte@server'] = account1

        account2 = weechat_otr_test.recording_account.RecordingAccount(
            'gefährte2@server')
        weechat_otr.ACCOUNTS['gefährte2@server'] = account2

        context1 = account2.getContext('gefährte@server')
        context2 = account1.getContext('gefährte2@server')

        weechat_otr.message_in_cb(
            None, None, 'server',
            ':gefährte2!user@host PRIVMSG gefährte :?OTRv2?')

        sys.modules['weechat'].set_server_current_nick('server', 'gefährte2')
        self.send_all('gefährte', 'gefährte2', context2.injected)

        sys.modules['weechat'].set_server_current_nick('server', 'gefährte')
        self.send_all('gefährte2', 'gefährte', context1.injected)

        sys.modules['weechat'].set_server_current_nick('server', 'gefährte2')
        self.send_all('gefährte', 'gefährte2', context2.injected)

        sys.modules['weechat'].set_server_current_nick('server', 'gefährte')
        self.send_all('gefährte2', 'gefährte', context1.injected)

        self.assertTrue(context1.is_encrypted())
        self.assertTrue(context2.is_encrypted())

        weechat_otr.message_out_cb(
            None, None, 'server', ':gefährte!user@host PRIVMSG gefährte2 :hi')

        sys.modules['weechat'].set_server_current_nick('server', 'gefährte2')

        result = weechat_otr.message_in_cb(
            None, None, 'server',
            ':gefährte!user@host PRIVMSG gefährte2 :%s' % \
            context2.injected.pop())

        self.assertEqual(
            result,
            weechat_otr.PYVER.to_str(
                ':gefährte!user@host PRIVMSG gefährte2 :hi'))
Ejemplo n.º 27
0
 def test_message_out_cb(self):
     result = weechat_otr.message_out_cb(None, None, 'server',
         ':nick!user@host PRIVMSG friend :hello')
     self.assertEqual(result, 'PRIVMSG friend :hello')
Ejemplo n.º 28
0
 def test_message_out_cb(self):
     result = weechat_otr.message_out_cb(
         None, None, 'server', ':nick!user@host PRIVMSG friend :hello')
     self.assertEqual(result, 'PRIVMSG friend :hello')
Ejemplo n.º 29
0
 def test_default_html_escape_policy(self):
     result = weechat_otr.message_out_cb(None, None, 'server',
         ':nick!user@host PRIVMSG friend :< > " \' &')
     self.assertEqual(result, 'PRIVMSG friend :< > " \' &')
Ejemplo n.º 30
0
    def test_exception_raised_prints_traceback(self):
        sys.modules['weechat'].info_get_hashtable_raise = Exception('test')

        weechat_otr.message_out_cb(None, None, 'server',
            ':nick!user@host PRIVMSG nick2 :hello')
        self.assertPrintedContains('', 'Exception: test')
Ejemplo n.º 31
0
    def test_exception_raised_returns_empty_string(self):
        sys.modules['weechat'].info_get_hashtable_raise = Exception('test')

        result = weechat_otr.message_out_cb(
            None, None, 'server', ':nick!user@host PRIVMSG nick2 :hello')
        self.assertEqual(result, '')
Ejemplo n.º 32
0
 def test_message_out_cb_nick_with_at(self):
     result = weechat_otr.message_out_cb(None, None, 'server',
         ':nick!user@host PRIVMSG @#chan :hello')
     self.assertEqual(result, ':nick!user@host PRIVMSG @#chan :hello')
Ejemplo n.º 33
0
    def test_html_escape_policy_off_unencrypted(self):
        sys.modules["weechat"].config_options["otr.policy.server.nick.friend.html_escape"] = "off"
        self.account.getContext("friend@server").is_encrypted_fake = False

        result = weechat_otr.message_out_cb(None, None, "server", ":nick!user@host PRIVMSG friend :< > \" ' &")
        self.assertEqual(result, "PRIVMSG friend :< > \" ' &")
 def test_default_html_escape_policy(self):
     result = weechat_otr.message_out_cb(
         None, None, 'server', ':nick!user@host PRIVMSG friend :< > " \' &')
     self.assertEqual(result, 'PRIVMSG friend :< > " \' &')
Ejemplo n.º 35
0
 def test_default_html_escape_policy(self):
     result = weechat_otr.message_out_cb(None, None, "server", ":nick!user@host PRIVMSG friend :< > \" ' &")
     self.assertEqual(result, "PRIVMSG friend :< > \" ' &")
Ejemplo n.º 36
0
    def test_exception_raised_returns_empty_string(self):
        sys.modules['weechat'].info_get_hashtable_raise = Exception('test')

        result = weechat_otr.message_out_cb(None, None, 'server',
            ':nick!user@host PRIVMSG nick2 :hello')
        self.assertEqual(result, '')
Ejemplo n.º 37
0
    def test_otr_session_non_ascii(self):
        sys.modules['weechat'].set_server_current_nick('server', 'gefährte')
        sys.modules['weechat'].infos.update({
            (weechat_otr.PYVER.to_str('server,gefährte'),) :
                {'irc_buffer' : 'server_gefährte_buffer'},
            (weechat_otr.PYVER.to_str('server,gefährte2'),) :
                {'irc_buffer' : 'server_gefährte2_buffer'},
            })
        sys.modules['weechat'].buffers.update({
            weechat_otr.PYVER.to_str('server_gefährte_buffer') : {
                'localvar_type' : 'private',
                'localvar_channel' : 'gefährte',
                'localvar_server' : 'server',
                'name' : 'server_gefährte_buffer_name',
                'plugin' : 'irc',
                },
            weechat_otr.PYVER.to_str('server_gefährte2_buffer') : {
                'localvar_type' : 'private',
                'localvar_channel' : 'gefährte2',
                'localvar_server' : 'server',
                'name' : 'server_gefährte2_buffer_name',
                'plugin' : 'irc',
                },
            })

        account1 = weechat_otr_test.recording_account.RecordingAccount(
            'gefährte@server')
        weechat_otr.ACCOUNTS['gefährte@server'] = account1

        account2 = weechat_otr_test.recording_account.RecordingAccount(
            'gefährte2@server')
        weechat_otr.ACCOUNTS['gefährte2@server'] = account2

        context1 = account2.getContext('gefährte@server')
        context2 = account1.getContext('gefährte2@server')

        weechat_otr.message_in_cb(
            None, None, 'server',
            ':gefährte2!user@host PRIVMSG gefährte :?OTRv2?')

        sys.modules['weechat'].set_server_current_nick('server', 'gefährte2')
        self.send_all('gefährte', 'gefährte2', context2.injected)

        sys.modules['weechat'].set_server_current_nick('server', 'gefährte')
        self.send_all('gefährte2', 'gefährte', context1.injected)

        sys.modules['weechat'].set_server_current_nick('server', 'gefährte2')
        self.send_all('gefährte', 'gefährte2', context2.injected)

        sys.modules['weechat'].set_server_current_nick('server', 'gefährte')
        self.send_all('gefährte2', 'gefährte', context1.injected)

        self.assertTrue(context1.is_encrypted())
        self.assertTrue(context2.is_encrypted())

        weechat_otr.message_out_cb(
            None, None, 'server', ':gefährte!user@host PRIVMSG gefährte2 :hi')

        sys.modules['weechat'].set_server_current_nick('server', 'gefährte2')

        result = weechat_otr.message_in_cb(
            None, None, 'server',
            ':gefährte!user@host PRIVMSG gefährte2 :%s' % \
            context2.injected.pop())

        self.assertEqual(result, weechat_otr.PYVER.to_str(
            ':gefährte!user@host PRIVMSG gefährte2 :hi'))
Ejemplo n.º 38
0
    def test_exception_raised_prints_traceback(self):
        sys.modules['weechat'].info_get_hashtable_raise = Exception('test')

        weechat_otr.message_out_cb(None, None, 'server',
                                   ':nick!user@host PRIVMSG nick2 :hello')
        self.assertPrintedContains('', 'Exception: test')