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

Add support for custom fields (lookup fields) #139

Merged
merged 21 commits into from
Aug 9, 2023
Merged

Conversation

somethingmorerelevant
Copy link
Member

@somethingmorerelevant somethingmorerelevant commented Jul 24, 2023

Description of change

Manual QA steps

Risks

Rollback steps

  • revert this branch

Why interger type for lookup fields and not string
Ans: here

Co-author - @lukas-gust

+ Added lookup custom field type with type integer.
Copy link
Contributor

@cosimon cosimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the new field to the all_fields test?

@somethingmorerelevant somethingmorerelevant changed the title Add support for custom fields Add support for custom fields (lookup fields) Jul 25, 2023
@somethingmorerelevant
Copy link
Member Author

Can you add the new field to the all_fields test?

This is not exactly a new field, but rather a custom field type, and I have setup lookup fields on few streams to validate lookup datatype.

I was thinking to add a new test case for the following reason:

  • This type of field is not available on the UI for selection (being a nested field) although the parent object is available for selection
  • all_fields_test only covers the fields in the root hierarchy of the object and does not cover nested fields/schema
  • the location of lookup fields varies for streams, hence its preferable to validate it separately.

@cosimon what are your thoughts about adding a new test?

@lukas-gust
Copy link
Contributor

Let me know if I can be of any assistance.

@somethingmorerelevant
Copy link
Member Author

Let me know if I can be of any assistance.

I have made some changes as suggested, once the team reviews and approves this change, i will merge this P.R.

Comment on lines 41 to 45
json_type = CUSTOM_TYPES.get(zendesk_type)
if json_type is None:
raise Exception("Discovered unsupported type for custom field {} (key: {}): {}"
.format(field.title,
field.key,
zendesk_type))
json_type = "string"
LOGGER.critical("Discovered unsupported type for custom field %s (key: %s): %s",
field.title, field.key, zendesk_type)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
json_type = CUSTOM_TYPES.get(zendesk_type)
if json_type is None:
raise Exception("Discovered unsupported type for custom field {} (key: {}): {}"
.format(field.title,
field.key,
zendesk_type))
json_type = "string"
LOGGER.critical("Discovered unsupported type for custom field %s (key: %s): %s",
field.title, field.key, zendesk_type)
if zendesk_type not in CUSTOM_TYPES:
LOGGER.critical("Discovered unsupported type for custom field %s (key: %s): %s",
field.title, field.key, zendesk_type)
json_type = CUSTOM_TYPES.get(zendesk_type) or "string"

@@ -111,7 +111,7 @@ def rate_tickets(self, records):
#zenpy_client.tickets.rate(id, rating) # example rating {'score': 'good'}


@ZendeskTest.skipUntilDone("TDL-20862")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove extra line here and other similar locations.

Copy link
Contributor

@RushiT0122 RushiT0122 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left some some suggestions, also since we are working on these test, this is good opportunity to replace print statements by tap_tester LOGGER.

@RushiT0122 RushiT0122 self-requested a review August 9, 2023 10:25
@somethingmorerelevant somethingmorerelevant merged commit 7e8c3fd into master Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants