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

Tdl 24145 #241

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Tdl 24145 #241

wants to merge 4 commits into from

Conversation

bhuvana-talend
Copy link
Contributor

Description of change

(https://jira.talendforge.org/browse/TDL-24145)
client.py - Added CRUD functionality for custom contact properties
test_hubspot_bookmarks.py - Call the create method in test data setup

Manual QA steps

Risks

Rollback steps

  • revert this branch

Copy link
Contributor

@bhtowles bhtowles left a comment

Choose a reason for hiding this comment

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

Will finish review tommorrow

"formField": True
}

# generate a contacts record
Copy link
Contributor

Choose a reason for hiding this comment

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

Dev has recommended using raise_for_status() after requests. As written we will just log bad responses and continue the test. Is this the desired behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

post method is doing the raise_for_status check. create_contacts method is doing similar to what is beoing done here. I took that as the template.

tests/client.py Outdated
},
{
"label": "Option C",
" value": "option_c"
Copy link
Contributor

Choose a reason for hiding this comment

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

Extra white space

@@ -53,6 +53,9 @@ def create_test_data(self, expected_streams):
for stream in expected_streams}

for stream in expected_streams - {'contacts_by_company'}:
""" Create custom properties for contacts """
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this meant to be a comment instead of a doc string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Meant to be a comment. I changed to #, don't really know the difference

def get_custom_property(self, url, params=dict()):
"""Perform a GET using the standard requests method and logs the action"""
"""Do not handle exception for get failure in custom contact properties"""
response = requests.get(url, params=params, headers=self.HEADERS)
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using raise_for_status()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is intentional. I don't want to raise the exception - rather handle it. If the property is already there, I would delete it. See line# 789 where it is called. In the next line, I am checking the status

if ( response.status_code == 404 ):
continue
url = f"{BASE_URL}/properties/v1/contacts/properties/named/" + property
response = self.delete(url)
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using raise_for_status(). Should we re-try if we fail on a delete?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm... raise_for_status will log it as an error. I don't know if we want that.

for record in actual_records:
for key, value in expected_primary_key_dict.items():
actual_value = record[key]
if actual_value != value:
Copy link
Contributor

Choose a reason for hiding this comment

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

Would like to run this and see in debugger.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me set up a time for this and to discuss the above comment

##########################################################################

@unittest.skip("Skip till all cards of missing fields are fixed. TDL-16145 ")
def test_all_fields_for_streams_are_replicated(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like the same test is listed twice and skipped here the second time. Confusing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have removed the testname and added the code as a comment to avoid confusion

'subscription_changes', # BUG_TDL-14938 https://jira.talendforge.org/browse/TDL-14938
})

def setUp(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Usually setUp is written to only run once even if multiple tests are called. This implementation seems to only have one test so it may not be an issue but I'd like to maintain the pattern if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's discuss on how to do this tap specific setUp

can_save = True
return ret_records

FIELDS_ADDED_BY_TAP = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Many of these dicts, and methods will be useful in other tests. I think most of them belong in base.

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.

2 participants