diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-01-30 16:45:59 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2017-01-31 14:12:46 -0800 |
commit | a030da17b4c450440f8dd8d5a5f828a272656c5a (patch) | |
tree | 5ab12d4fe9093e56aec8d13b44fa3f576d3cf697 /tests | |
parent | cc2871fdf28bb045e42f2aaef167eda52a076464 (diff) |
commands/init_test: Basic tests for registerCommand
Diffstat (limited to 'tests')
-rw-r--r-- | tests/commands/init_test.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/commands/init_test.py b/tests/commands/init_test.py index f5a37997..5caf7eb0 100644 --- a/tests/commands/init_test.py +++ b/tests/commands/init_test.py @@ -7,6 +7,8 @@ from __future__ import absolute_import import argparse import unittest +import mock + from alot import commands from alot.commands import thread @@ -28,3 +30,16 @@ class TestCommandFactory(unittest.TestCase): self.assertIsInstance(cmd, thread.SaveAttachmentCommand) self.assertTrue(cmd.all) self.assertEqual(cmd.path, u'/foo') + + +class TestRegisterCommand(unittest.TestCase): + """Tests for the registerCommand class.""" + + def test_registered(self): + """using registerCommand adds to the COMMANDS dict.""" + with mock.patch('alot.commands.COMMANDS', {'foo': {}}): + @commands.registerCommand('foo', 'test') + def foo(): + pass + + self.assertIn('test', commands.COMMANDS['foo']) |