39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
#-*- coding: utf-8; -*-
|
|
|
|
import inspect
|
|
from unittest import TestCase
|
|
|
|
from wuttasync.cli import base as mod
|
|
|
|
|
|
class TestImporterCommand(TestCase):
|
|
|
|
def test_basic(self):
|
|
def myfunc(ctx, **kwargs):
|
|
pass
|
|
|
|
sig1 = inspect.signature(myfunc)
|
|
self.assertIn('kwargs', sig1.parameters)
|
|
self.assertNotIn('dry_run', sig1.parameters)
|
|
wrapt = mod.importer_command(myfunc)
|
|
sig2 = inspect.signature(wrapt)
|
|
self.assertNotIn('kwargs', sig2.parameters)
|
|
self.assertIn('dry_run', sig2.parameters)
|
|
|
|
|
|
class TestFileImporterCommand(TestCase):
|
|
|
|
def test_basic(self):
|
|
def myfunc(ctx, **kwargs):
|
|
pass
|
|
|
|
sig1 = inspect.signature(myfunc)
|
|
self.assertIn('kwargs', sig1.parameters)
|
|
self.assertNotIn('dry_run', sig1.parameters)
|
|
self.assertNotIn('input_file_path', sig1.parameters)
|
|
wrapt = mod.file_importer_command(myfunc)
|
|
sig2 = inspect.signature(wrapt)
|
|
self.assertNotIn('kwargs', sig2.parameters)
|
|
self.assertIn('dry_run', sig2.parameters)
|
|
self.assertIn('input_file_path', sig2.parameters)
|