def test_get_notification_html_requested_success_no_optional_options( self) -> None: """ Test successful generation of html for 'requested' notification email using all required fields and no optional fields :return: """ test_sender = '*****@*****.**' test_options = { 'resource_name': 'testtable', 'resource_path': '/testpath', } with local_app.app_context(): html = get_notification_html( notification_type=NotificationType.METADATA_REQUESTED, options=test_options, sender=test_sender) expectedHTML = ( 'Hello,<br/><br/>[email protected] is trying to use ' '<a href="http://0.0.0.0:5000/testpath?source=notification">testtable</a>, and requests ' 'more information about that resource.<br/><br/>Please visit the provided link and improve ' 'descriptions on that resource.<br/><br/>Thanks,<br/>Amundsen Team' ) self.assertEqual(html, expectedHTML)
def test_get_notification_html_added_success(self) -> None: """ Test successful generation of html for 'added' notification email :return: """ test_sender = '*****@*****.**' test_options = { 'resource_name': 'testtable', 'resource_path': '/testpath' } with local_app.app_context(): html = get_notification_html( notification_type=NotificationType.OWNER_ADDED, options=test_options, sender=test_sender) expectedHTML = ( 'Hello,<br/><br/>You have been added to the owners list of the ' '<a href="http://0.0.0.0:5000/testpath?source=notification">testtable</a>' ' dataset by [email protected].<br/><br/>What is expected of you?<br/>As an owner, you take an ' 'important part in making sure that the datasets you own can be used as swiftly as possible ' 'across the company.<br/>Make sure the metadata is correct and up to date.<br/><br/>If you ' 'think you are not the best person to own this dataset and know someone who might be, please ' 'contact this person and ask them if they want to replace you. It is important that we keep ' 'multiple owners for each dataset to ensure continuity.<br/><br/>Thanks,<br/>Amundsen Team' ) self.assertEqual(html, expectedHTML)
def test_get_notification_html_requested_success_all_fields(self) -> None: """ Test successful generation of html for 'requested' notification email using all required and optional fields :return: """ test_sender = '*****@*****.**' test_options = { 'resource_name': 'testtable', 'resource_path': '/testpath', 'description_requested': True, 'fields_requested': True, 'comment': 'Test Comment' } with local_app.app_context(): html = get_notification_html( notification_type=NotificationType.METADATA_REQUESTED, options=test_options, sender=test_sender) expectedHTML = ( 'Hello,<br/><br/>[email protected] is trying to use ' '<a href="http://0.0.0.0:5000/testpath?source=notification">testtable</a>, ' 'and requests improved table and column descriptions.<br/><br/>[email protected] has included the ' 'following information with their request:<br/>Test Comment<br/><br/>Please visit the provided ' 'link and improve descriptions on that resource.<br/><br/>Thanks,<br/>Amundsen Team' ) self.assertEqual(html, expectedHTML)
def test_get_notification_html_removed_success(self) -> None: """ Test successful generation of html for 'removed' notification email :return: """ test_sender = '*****@*****.**' test_options = {'resource_name': 'testtable', 'resource_path': '/testpath'} with local_app.app_context(): html = get_notification_html(notification_type=NotificationType.OWNER_REMOVED, options=test_options, sender=test_sender) expectedHTML = ('Hello,<br/><br/>You have been removed from the owners list of the ' '<a href="http://0.0.0.0:5000/testpath?source=notification">testtable</a> dataset by' ' [email protected].<br/><br/>If you think you have been incorrectly removed as an owner,' ' add yourself back to the owners list.<br/><br/>Thanks,<br/>Amundsen Team') self.assertEqual(html, expectedHTML)