fix: add --list-models option for import/export commands

also rename the command decorators for consistency
This commit is contained in:
Lance Edgar 2024-12-06 09:06:45 -06:00
parent 7ee551d446
commit 15b2cb07ba
8 changed files with 230 additions and 47 deletions

View file

@ -1,24 +1,19 @@
#-*- coding: utf-8; -*-
import os
from unittest import TestCase
from unittest.mock import MagicMock, patch
from wuttasync.cli import import_csv as mod
from wuttasync.importing.csv import FromCsvToWutta
from wuttasync.cli import import_csv as mod, ImportCommandHandler
here = os.path.dirname(__file__)
example_conf = os.path.join(here, 'example.conf')
class TestImportCsv(TestCase):
def test_basic(self):
ctx = MagicMock(params={'models': [],
'create': True, 'update': True, 'delete': False,
'dry_run': True})
with patch.object(FromCsvToWutta, 'process_data') as process_data:
params = {'models': [],
'create': True, 'update': True, 'delete': False,
'dry_run': True}
ctx = MagicMock(params=params)
with patch.object(ImportCommandHandler, 'run') as run:
mod.import_csv(ctx)
process_data.assert_called_once_with(create=True, update=True, delete=False,
dry_run=True)
run.assert_called_once_with(params)