Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: unbreak 1.1.9 #123

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pysnc/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,7 @@ def serialize_all(self, display_value=False, fields=None, fmt=None, exclude_refe
:param fmt:
:return: list
"""
return [record.serialize(display_value=display_value, fields=fields, fmd=fmt, exclude_reference_link=exclude_reference_link) for record in self]
return [record.serialize(display_value=display_value, fields=fields, fmt=fmt, exclude_reference_link=exclude_reference_link) for record in self]

def to_pandas(self, columns=None, mode='smart'):
"""
Expand Down
21 changes: 21 additions & 0 deletions test/test_snc_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,26 @@ def test_str(self):
self.assertTrue('intfield' in data)
client.session.close()

def test_serialize_all(self):
client = ServiceNowClient(self.c.server, self.c.credentials)
gr = client.GlideRecord('problem')
gr.fields = 'sys_id,short_description,state'
gr.limit = 4
gr.query()
data = gr.serialize_all()
self.assertEqual(len(data), 4)
for prb in data:
self.assertEqual(list(prb.keys()), ['sys_id', 'short_description', 'state'])

# we do *not* expect the link if we are value-only
data = gr.serialize_all(exclude_reference_link=False)
self.assertEqual(type(data[0]['short_description']), str)

# TODO: test this
#data = gr.serialize_all(display_value='both', exclude_reference_link=False)
#self.assertEqual(type(data[0]['short_description']), dict)
#print(data[0]['short_description'])
#self.assertTrue('value' in data[0]['short_description']['link'])
client.session.close()


Loading