Skip to content
Snippets Groups Projects
test_karma.py 1.56 KiB
# Copyright © 2018 Bruce Cowan <bruce@bcowan.eu>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

pytest_plugins = ["errbot.backends.test"]

extra_plugin_dir = '.'

def test_regex(testbot):
    testbot.assertCommand("test++", "Karma for 'test' is now 1")
    testbot.assertCommand("!karma test", "Karma for 'test' is 1")

    testbot.assertCommand("test--", "Karma for 'test' is now 0")
    testbot.assertCommand("!karma test", "Karma for 'test' is 0")

def test_top_bottom(testbot):
    testbot.assertCommand("high++", "Karma for 'high' is now 1")
    testbot.assertCommand("high++", "Karma for 'high' is now 2")
    testbot.assertCommand("medium++", "Karma for 'medium' is now 1")
    testbot.assertCommand("low--", "Karma for 'low' is now -1")

    testbot.assertCommand("!karma top", "high: 2, medium: 1, low: -1")
    testbot.assertCommand("!karma bottom", "low: -1, medium: 1, high: 2")

    testbot.assertCommand("!karma top 1", "high: 2")
    testbot.assertCommand("!karma top 2", "high: 2, medium: 1")