Skip to content

Commit ea8e89a

Browse files
committed
Add test for apply mappings with same name #235
1 parent 44b0e44 commit ea8e89a

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

about_code_tool/tests/test_tstutil.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,39 @@ def test_apply_mappings(self):
6666
result = util.apply_mappings(test_fields, mappings)
6767
self.assertEqual(expected, result)
6868

69+
def test_apply_mappings_same_name(self):
70+
mappings = {
71+
'about_file': 'Directory/Filename',
72+
'version': 'Confirmed Version',
73+
'about_resource': 'file_name',
74+
'name': 'Component',
75+
'component' : 'Component'
76+
}
77+
78+
test_fields = [
79+
{
80+
'file_name': 'opensans',
81+
'ignore field': 'i',
82+
'Component': 'OpenSans Fonts',
83+
'Confirmed Version': '1',
84+
'Directory/Filename': '/extension/streamer/opensans/',
85+
}
86+
]
87+
88+
expected = [
89+
{
90+
'about_resource': 'opensans',
91+
'ignore field': 'i',
92+
'name': 'OpenSans Fonts',
93+
'version': '1',
94+
'about_file': '/extension/streamer/opensans/',
95+
'component': 'OpenSans Fonts',
96+
}
97+
]
98+
99+
result = util.apply_mappings(test_fields, mappings)
100+
self.assertEqual(expected, result)
101+
69102
def test_util_resource_name(self):
70103
expected = 'first'
71104
result = util.resource_name('some/things/first')

0 commit comments

Comments
 (0)