def test_process_rename(self): data = {'id': 1, 'title': 'One', 'baz': {'id': 1}} norm = Normalize() norm.define_primary('foo') norm.rename_flds('foo', 'title', 'heading') norm.rename_flds('foo', 'asdf', 'qwer') self.assertEqual(norm._process_data_changes('foo', data), { 'baz': { 'id': 1 }, 'id': 1, 'heading': 'One' })
def test_rename_flds(self): norm = Normalize() norm.define_primary('foo') norm.rename_flds('foo', 'title', 'heading') self.assertEqual(norm.parse([{ 'id': 1, 'title': 'One' }]), { 'entities': { 'foo': { 1: { 'heading': 'One', 'id': 1 } } }, 'results': [1] })