コード例 #1
0
ファイル: test_meant_to_say.py プロジェクト: michaelorr/helga
    def test_gi_with_garbage_flags(self):
        self.client.last_message['#bots']['me'] = 'this is a FOO message foo'

        resp = meant_to_say.meant_to_say(self.client, '#bots', 'me',
                                         's/foo/bar/gic',
                                         [('foo', 'bar', '/gic')])
        assert resp == 'me meant to say: this is a bar message bar'
コード例 #2
0
ファイル: test_meant_to_say.py プロジェクト: michaelorr/helga
def test_meant_to_say_returns_modified():
    client = stub(last_message=defaultdict(dict))
    client.last_message['#bots']['me'] = 'this is a foo message'

    resp = meant_to_say.meant_to_say(client, '#bots', 'me', 's/foo/bar',
                                     [('foo', 'bar', '')])
    assert resp == 'me meant to say: this is a bar message'
コード例 #3
0
    def test_single_replacement(self):
        self.client.last_message['#bots']['me'] = 'this is a foo message foo'

        resp = meant_to_say.meant_to_say(
            self.client,
            '#bots',
            'me',
            's/foo/bar/',
            [('foo', 'bar', '/')]
        )
        assert resp == 'me meant to say: this is a bar message foo'
コード例 #4
0
    def test_gi_with_garbage_flags(self):
        self.client.last_message['#bots']['me'] = 'this is a FOO message foo'

        resp = meant_to_say.meant_to_say(
            self.client,
            '#bots',
            'me',
            's/foo/bar/gic',
            [('foo', 'bar', '/gic')]
        )
        assert resp == 'me meant to say: this is a bar message bar'
コード例 #5
0
    def test_i(self):
        self.client.last_message['#bots']['me'] = 'this is a FOO message'

        resp = meant_to_say.meant_to_say(
            self.client,
            '#bots',
            'me',
            's/foo/bar/i',
            [('foo', 'bar', '/i')]
        )
        assert resp == 'me meant to say: this is a bar message'
コード例 #6
0
ファイル: test_meant_to_say.py プロジェクト: michaelorr/helga
def test_meant_to_say_none_when_no_last_message():
    client = stub(last_message=defaultdict(dict))
    assert meant_to_say.meant_to_say(client, '#bots', 'me', 's/foo/bar',
                                     [('foo', 'bar', '')]) is None
コード例 #7
0
ファイル: test_meant_to_say.py プロジェクト: michaelorr/helga
    def test_i(self):
        self.client.last_message['#bots']['me'] = 'this is a FOO message'

        resp = meant_to_say.meant_to_say(self.client, '#bots', 'me',
                                         's/foo/bar/i', [('foo', 'bar', '/i')])
        assert resp == 'me meant to say: this is a bar message'
コード例 #8
0
ファイル: test_meant_to_say.py プロジェクト: michaelorr/helga
    def test_single_replacement(self):
        self.client.last_message['#bots']['me'] = 'this is a foo message foo'

        resp = meant_to_say.meant_to_say(self.client, '#bots', 'me',
                                         's/foo/bar/', [('foo', 'bar', '/')])
        assert resp == 'me meant to say: this is a bar message foo'
コード例 #9
0
ファイル: test_meant_to_say.py プロジェクト: michaelorr/helga
def test_meant_to_say_none_when_not_modified():
    client = stub(last_message=defaultdict(dict))
    client.last_message['#bots']['me'] = 'this is a message'

    assert meant_to_say.meant_to_say(client, '#bots', 'me', 's/foo/bar',
                                     [('foo', 'bar', '')]) is None
コード例 #10
0
def test_meant_to_say_none_when_no_last_message():
    client = stub(last_message=defaultdict(dict))
    assert meant_to_say.meant_to_say(client, '#bots', 'me', 's/foo/bar', [('foo', 'bar', '')]) is None
コード例 #11
0
def test_meant_to_say_none_when_not_modified():
    client = stub(last_message=defaultdict(dict))
    client.last_message['#bots']['me'] = 'this is a message'

    assert meant_to_say.meant_to_say(client, '#bots', 'me', 's/foo/bar', [('foo', 'bar', '')]) is None
コード例 #12
0
def test_meant_to_say_returns_modified():
    client = stub(last_message=defaultdict(dict))
    client.last_message['#bots']['me'] = 'this is a foo message'

    resp = meant_to_say.meant_to_say(client, '#bots', 'me', 's/foo/bar', [('foo', 'bar', '')])
    assert resp == 'me meant to say: this is a bar message'
コード例 #13
0
ファイル: test_meant_to_say.py プロジェクト: pschwartz/helga
def test_meant_to_say_none_when_no_last_message():
    client = stub(last_message=defaultdict(dict))
    assert meant_to_say.meant_to_say(client, "#bots", "me", "s/foo/bar", [("foo", "bar")]) is None
コード例 #14
0
ファイル: test_meant_to_say.py プロジェクト: pschwartz/helga
def test_meant_to_say_none_when_not_modified():
    client = stub(last_message=defaultdict(dict))
    client.last_message["#bots"]["me"] = "this is a message"

    assert meant_to_say.meant_to_say(client, "#bots", "me", "s/foo/bar", [("foo", "bar")]) is None
コード例 #15
0
ファイル: test_meant_to_say.py プロジェクト: pschwartz/helga
def test_meant_to_say_returns_modified():
    client = stub(last_message=defaultdict(dict))
    client.last_message["#bots"]["me"] = "this is a foo message"

    resp = meant_to_say.meant_to_say(client, "#bots", "me", "s/foo/bar", [("foo", "bar")])
    assert resp == "me meant to say: this is a bar message"