|
@@ 36-45 (lines=10) @@
|
| 33 |
|
msg = message.Message(body="") |
| 34 |
|
msg.command = "plugins" |
| 35 |
|
result = yield from botutils.onCommand(msg) |
| 36 |
|
self.assertEqual(type(result), type(msg)) |
| 37 |
|
|
| 38 |
|
|
| 39 |
|
def test_botutils_commands(self): |
| 40 |
|
result = botutils.onInit(__import__('api.plugin')) |
| 41 |
|
bot.Bot.plugins.append(result) |
| 42 |
|
for command in result.commands: |
| 43 |
|
bot.Bot.commands.append(command) |
| 44 |
|
|
| 45 |
|
msg = message.Message(body="") |
| 46 |
|
msg.command = "commands" |
| 47 |
|
result = yield from botutils.onCommand(msg) |
| 48 |
|
self.assertEqual(type(result), type(msg)) |
|
@@ 25-34 (lines=10) @@
|
| 22 |
|
def test_srcutils_import(self): |
| 23 |
|
result = botutils.onInit(__import__('api.plugin')) |
| 24 |
|
self.assertEqual(type(result), plugin.Plugin) |
| 25 |
|
|
| 26 |
|
|
| 27 |
|
def test_botutils_plugin(self): |
| 28 |
|
result = botutils.onInit(__import__('api.plugin')) |
| 29 |
|
bot.Bot.plugins.append(result) |
| 30 |
|
for command in result.commands: |
| 31 |
|
bot.Bot.commands.append(command) |
| 32 |
|
|
| 33 |
|
msg = message.Message(body="") |
| 34 |
|
msg.command = "plugins" |
| 35 |
|
result = yield from botutils.onCommand(msg) |
| 36 |
|
self.assertEqual(type(result), type(msg)) |
| 37 |
|
|
|
@@ 13-22 (lines=10) @@
|
| 10 |
|
# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
|
# See the License for the specific language governing permissions and |
| 13 |
|
# limitations under the License. |
| 14 |
|
|
| 15 |
|
import unittest |
| 16 |
|
from api import message, plugin, bot |
| 17 |
|
from plugins import botutils |
| 18 |
|
from tests.fake_server import Server |
| 19 |
|
|
| 20 |
|
class TestBotutilsSuite(unittest.TestCase): |
| 21 |
|
|
| 22 |
|
def test_srcutils_import(self): |
| 23 |
|
result = botutils.onInit(__import__('api.plugin')) |
| 24 |
|
self.assertEqual(type(result), plugin.Plugin) |
| 25 |
|
|