feat: initial release
just the basics in place for an ad-hoc CSV -> Wutta import. framework API only at this point, no CLI yet
This commit is contained in:
commit
e19eab418a
37 changed files with 3793 additions and 0 deletions
29
tests/test_util.py
Normal file
29
tests/test_util.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
|
||||
from unittest import TestCase
|
||||
|
||||
from wuttasync import util as mod
|
||||
|
||||
|
||||
class TestDataDiffs(TestCase):
|
||||
|
||||
def test_source_missing_field(self):
|
||||
source = {'foo': 'bar'}
|
||||
target = {'baz': 'xyz', 'foo': 'bar'}
|
||||
self.assertRaises(KeyError, mod.data_diffs, source, target)
|
||||
|
||||
def test_target_missing_field(self):
|
||||
source = {'foo': 'bar', 'baz': 'xyz'}
|
||||
target = {'baz': 'xyz'}
|
||||
self.assertRaises(KeyError, mod.data_diffs, source, target, fields=['foo', 'baz'])
|
||||
|
||||
def test_no_diffs(self):
|
||||
source = {'foo': 'bar', 'baz': 'xyz'}
|
||||
target = {'baz': 'xyz', 'foo': 'bar'}
|
||||
self.assertFalse(mod.data_diffs(source, target))
|
||||
|
||||
def test_with_diffs(self):
|
||||
source = {'foo': 'bar', 'baz': 'xyz'}
|
||||
target = {'baz': 'xyz', 'foo': 'BAR'}
|
||||
result = mod.data_diffs(source, target)
|
||||
self.assertEqual(result, ['foo'])
|
Loading…
Add table
Add a link
Reference in a new issue