This repository has been archived by the owner on May 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81736ab
commit da0ee60
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -*- coding:utf-8 -*- | ||
import os | ||
import tempfile | ||
|
||
from flexmock import flexmock | ||
|
||
from orator.commands.command import Command | ||
|
||
from . import OratorCommandTestCase | ||
|
||
|
||
class FooCommand(Command): | ||
""" | ||
Test Command | ||
""" | ||
name = 'foo' | ||
|
||
def handle(self): | ||
pass | ||
|
||
|
||
class CommandTestCase(OratorCommandTestCase): | ||
def test_get_py_config_and_require___file__(self): | ||
filename = tempfile.mktemp('.py') | ||
with open(filename, 'w') as f: | ||
f.write('foo = __file__') | ||
|
||
command = flexmock(FooCommand()) | ||
command.should_call('_get_config').and_return({'foo': filename}) | ||
|
||
self.run_command(command, [('-c', filename)]) | ||
|
||
if os.path.exists(filename): | ||
os.remove(filename) |