Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Commit 1914e1a

Browse files
committed
add _get_config test case.
1 parent 5c81255 commit 1914e1a

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/commands/test_command.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# -*- coding:utf-8 -*-
2+
import os
3+
import tempfile
4+
5+
from flexmock import flexmock
6+
7+
from orator.commands.command import Command
8+
9+
from . import OratorCommandTestCase
10+
11+
12+
class FooCommand(Command):
13+
"""
14+
Test Command
15+
"""
16+
name = 'foo'
17+
18+
def handle(self):
19+
pass
20+
21+
22+
class CommandTestCase(OratorCommandTestCase):
23+
def test_get_py_config_and_require___file__(self):
24+
filename = tempfile.mktemp('.py')
25+
with open(filename, 'w') as f:
26+
f.write('foo = __file__')
27+
28+
command = flexmock(FooCommand())
29+
command.should_call('_get_config').and_return({'foo': filename})
30+
31+
self.run_command(command, [('-c', filename)])
32+
33+
if os.path.exists(filename):
34+
os.remove(filename)

0 commit comments

Comments
 (0)