blob: e9d6eadb2cfd4918acacfc8c833c7eafc40a67cc (
plain)
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
53
54
55
56
|
from pecan.tests import PecanTestCase
class TestCommandManager(PecanTestCase):
def test_commands(self):
from pecan.commands import ServeCommand, ShellCommand, CreateCommand
from pecan.commands.base import CommandManager
m = CommandManager()
assert m.commands['serve'] == ServeCommand
assert m.commands['shell'] == ShellCommand
assert m.commands['create'] == CreateCommand
class TestCommandRunner(PecanTestCase):
def test_commands(self):
from pecan.commands import (
ServeCommand, ShellCommand, CreateCommand, CommandRunner
)
runner = CommandRunner()
assert runner.commands['serve'] == ServeCommand
assert runner.commands['shell'] == ShellCommand
assert runner.commands['create'] == CreateCommand
def test_run(self):
from pecan.commands import CommandRunner
runner = CommandRunner()
self.assertRaises(
RuntimeError,
runner.run,
['serve', 'missing_file.py']
)
class TestCreateCommand(PecanTestCase):
def test_run(self):
from pecan.commands import CreateCommand
class FakeArg(object):
project_name = 'default'
template_name = 'default'
class FakeScaffold(object):
def copy_to(self, project_name):
assert project_name == 'default'
class FakeManager(object):
scaffolds = {
'default': FakeScaffold
}
c = CreateCommand()
c.manager = FakeManager()
c.run(FakeArg())
|