This repository was archived by the owner on Apr 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_alias.py
More file actions
52 lines (40 loc) · 1.86 KB
/
Copy pathtest_alias.py
File metadata and controls
52 lines (40 loc) · 1.86 KB
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
46
47
48
49
50
51
52
import os
import unittest
import alias
from flaky import flaky
from errbot.backends.test import testbot
@flaky
class TestAliasPlugin(object):
extra_plugin_dir = '.'
def test_command_alias_add(self, testbot):
testbot.push_message('!alias add s status')
assert 'Alias created.' in testbot.pop_message()
def test_command_alias_add_exists(self, testbot):
testbot.push_message('!alias add s status')
assert 'Alias created.' in testbot.pop_message()
testbot.push_message('!alias add s status')
assert 'An alias with that name already exists.' in testbot.pop_message()
def test_command_alias_add_usage(self, testbot):
testbot.push_message('!alias add')
assert 'usage: !alias add <name> <command>' in testbot.pop_message()
def test_command_alias_list(self, testbot):
testbot.push_message('!alias add s status')
testbot.pop_message()
testbot.push_message('!alias')
assert '!s = !status' in testbot.pop_message()
def test_command_alias_list_not_defined(self, testbot):
testbot.push_message('!alias')
assert 'No aliases found. Use !alias add to define one.' in testbot.pop_message()
def test_command_alias_remove(self, testbot):
testbot.push_message('!alias add s status')
testbot.pop_message()
testbot.push_message('!alias remove s')
assert 'Alias removed.' in testbot.pop_message()
testbot.push_message('!alias')
assert '!s = !status' not in testbot.pop_message()
def test_command_alias_remove_not_exists(self, testbot):
testbot.push_message('!alias remove s')
assert 'That alias does not exist.' in testbot.pop_message()
def test_command_alias_remove_usage(self, testbot):
testbot.push_message('!alias remove')
assert 'usage: !alias remove <name>' in testbot.pop_message()