Skip to content

Commit 5abd882

Browse files
authored
Merge pull request #123 from ServiceNow/scratch/fix-add-tests-121
fix!: unbreak 1.1.9
2 parents d0ab688 + 9d035ad commit 5abd882

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

pysnc/record.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ def serialize_all(self, display_value=False, fields=None, fmt=None, exclude_refe
10911091
:param fmt:
10921092
:return: list
10931093
"""
1094-
return [record.serialize(display_value=display_value, fields=fields, fmd=fmt, exclude_reference_link=exclude_reference_link) for record in self]
1094+
return [record.serialize(display_value=display_value, fields=fields, fmt=fmt, exclude_reference_link=exclude_reference_link) for record in self]
10951095

10961096
def to_pandas(self, columns=None, mode='smart'):
10971097
"""

test/test_snc_serialization.py

+21
Original file line numberDiff line numberDiff line change
@@ -219,5 +219,26 @@ def test_str(self):
219219
self.assertTrue('intfield' in data)
220220
client.session.close()
221221

222+
def test_serialize_all(self):
223+
client = ServiceNowClient(self.c.server, self.c.credentials)
224+
gr = client.GlideRecord('problem')
225+
gr.fields = 'sys_id,short_description,state'
226+
gr.limit = 4
227+
gr.query()
228+
data = gr.serialize_all()
229+
self.assertEqual(len(data), 4)
230+
for prb in data:
231+
self.assertEqual(list(prb.keys()), ['sys_id', 'short_description', 'state'])
232+
233+
# we do *not* expect the link if we are value-only
234+
data = gr.serialize_all(exclude_reference_link=False)
235+
self.assertEqual(type(data[0]['short_description']), str)
236+
237+
# TODO: test this
238+
#data = gr.serialize_all(display_value='both', exclude_reference_link=False)
239+
#self.assertEqual(type(data[0]['short_description']), dict)
240+
#print(data[0]['short_description'])
241+
#self.assertTrue('value' in data[0]['short_description']['link'])
242+
client.session.close()
222243

223244

0 commit comments

Comments
 (0)