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

Commit

Permalink
add _get_config test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
luoxiaohei committed Nov 18, 2019
1 parent 81736ab commit da0ee60
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/commands/test_command.py
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)

0 comments on commit da0ee60

Please sign in to comment.