File: dummy.py

package info (click to toggle)
errbot 6.2.0%2Bds-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,856 kB
  • sloc: python: 11,572; makefile: 163; sh: 97
file content (45 lines) | stat: -rw-r--r-- 1,039 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from __future__ import absolute_import

from errbot import BotPlugin, botcmd, botmatch, re_botcmd


class DummyTest(BotPlugin):
    """Just a test plugin to see if it is picked up."""

    @botcmd
    def foo(self, msg, args):
        """This runs foo."""
        return "bar"

    @re_botcmd(pattern=r"plz dont match this")
    def re_foo(self, msg, match):
        """This runs re_foo."""
        return "bar"

    @botmatch(r"match this")
    def re_bar(self, msg, match):
        """This runs re_foo."""
        return "bar"

    @botcmd
    def run_subcommands(self, msg, args):
        """Tests a simple subcommand"""
        return args

    @botcmd
    def run_lots_of_subcommands(self, msg, args):
        """Tests multiple subcommands"""
        return args

    def helper_method(self, arg):
        return arg

    @botcmd
    def baz(self, msg, args):
        """Tests mock injection method"""
        return self.helper_method("baz")

    @botcmd
    def bar(self, msg, args):
        """This runs bar."""
        return msg