def test_invite_papers_notification(self):
        """Method to test the actions associated with an invite to submit papers."""

        with app.test_request_context():
            request_cfs_url = 'https://localhost/e/cfs/345525'
            request_submit_url = 'https://localhost/e/cfs/345525/submit'
            response = get_invite_papers_notification_actions(request_cfs_url, request_submit_url)
            expected_cfs_action = NotificationAction(
                subject='call-for-speakers',
                link=request_cfs_url,
                action_type='view'
            )
            expected_submit_action = NotificationAction(
                subject='call-for-speakers',
                link=request_submit_url,
                action_type='submit'
            )
            expected_response = [expected_cfs_action, expected_submit_action]
            expected_response_length = len(expected_response)
            response_length = len(response)

            self.assertIsInstance(response, list)
            self.assertEqual(expected_cfs_action.subject, response[0].subject)
            self.assertEqual(expected_submit_action.subject, response[1].subject)
            self.assertEqual(expected_response_length, response_length)
def get_invite_papers_notification_actions(cfs_link, submit_link):
    """
    Get the actions associated with an invite to submit papers.
    :param cfs_link: link of call for speakers.
    :param submit_link: link to submit papers.
    :return:
    """
    view_cfs_action = NotificationAction(subject='call-for-speakers',
                                         link=cfs_link,
                                         action_type='view')
    submit_paper_action = NotificationAction(subject='call-for-speakers',
                                             link=submit_link,
                                             action_type='submit')
    save_to_db(view_cfs_action)
    save_to_db(submit_paper_action)
    return [view_cfs_action, submit_paper_action]
def get_ticket_purchased_attendee_notification_actions(pdf_url):
    """
    Get the actions associated with a notification of tickets purchased for an attendee that is not the buyer.
    :param pdf_url:
    :return: actions
    """
    view_ticket_action = NotificationAction(subject='tickets-pdf',
                                            link=pdf_url,
                                            action_type='view')
    save_to_db(view_ticket_action)
    return [view_ticket_action]
def get_event_exported_actions(download_url):
    """
    Get the actions associated with a notification about an event being successfully exported.
    :param download_url: download url of the event.
    :return: actions.
    """
    download_action = NotificationAction(subject='event-export',
                                         link=download_url,
                                         action_type='download')
    save_to_db(download_action)
    return [download_action]
Ejemplo n.º 5
0
def get_next_event_notification_actions(event_id, link):
    """
    Get the actions associated with a notification of next event.
    :param event_id: id of the event.
    :param link: link to view the event.
    :return: actions
    """
    view_event_action = NotificationAction(
        subject='event', link=link, subject_id=event_id, action_type='view'
    )
    save_to_db(view_event_action)
    return [view_event_action]
Ejemplo n.º 6
0
def get_event_published_notification_actions(event_id, event_link):
    """
    Get the actions associated with a notification of an event getting published.
    :param event_id: event id
    :param event_link: event url
    :return: actions
    """
    view_event_action = NotificationAction(
        subject='event', subject_id=event_id, link=event_link, action_type='view'
    )
    save_to_db(view_event_action)
    return [view_event_action]
Ejemplo n.º 7
0
def get_ticket_purchased_organizer_notification_actions(order_id, order_url):
    """
    Get the actions associated with a notification of tickets purchased for the event organizer.
    :param order_id: order id
    :param order_url: order url
    :return: actions
    """
    view_ticket_action = NotificationAction(
        subject='order', subject_id=order_id, link=order_url, action_type='view'
    )
    save_to_db(view_ticket_action)
    return [view_ticket_action]
Ejemplo n.º 8
0
def get_session_accept_reject_notification_actions(session_id, link):
    """
    Get the actions associated with a notification of a session getting accepted/rejected.
    :param session_id: id of the session.
    :param link: link to view the session.
    :return: actions
    """
    view_session_action = NotificationAction(
        subject='session', link=link, subject_id=session_id, action_type='view'
    )
    save_to_db(view_session_action)
    return [view_session_action]
Ejemplo n.º 9
0
def get_monthly_payment_follow_up_notification_actions(event_id, payment_url):
    """
    Get the actions associated with a follow up notification of monthly payments.
    :param event_id: id of the event.
    :param payment_url: url to view invoice.
    :return: actions
    """
    view_invoice_action = NotificationAction(
        subject='invoice', link=payment_url, subject_id=event_id, action_type='view'
    )
    save_to_db(view_invoice_action)
    return [view_invoice_action]
Ejemplo n.º 10
0
def get_ticket_purchased_notification_actions(order_id, order_url):
    """
    Get the actions associated with a notification of tickets purchased.
    :param order_id: order id
    :param order_url: order invoice url.
    :return:
    """
    view_order_invoice_action = NotificationAction(
        subject='order', link=order_url, subject_id=order_id, action_type='view'
    )
    save_to_db(view_order_invoice_action)
    return [view_order_invoice_action]
Ejemplo n.º 11
0
def get_event_role_notification_actions(event_id, invitation_link):
    """
    Get the actions associated with a notification of an event role.
    :param event_id: ID of the event.
    :param invitation_link: link for invitation.
    :return: actions
    """
    accept_event_role_action = NotificationAction(subject='event-role',
                                                  subject_id=event_id,
                                                  link=invitation_link,
                                                  action_type='view')
    save_to_db(accept_event_role_action)
    return [accept_event_role_action]
def get_event_imported_actions(event_id, event_url):
    """
    Get the actions associated with a notification about an event being successfully imported.
    :param event_id: id of the event.
    :param event_url: url of the event.
    :return: actions
    """
    view_event_action = NotificationAction(
        subject='event',  # subject is still 'event' since the action will be to view the imported event.
        link=event_url,
        subject_id=event_id,
        action_type='view'
    )
    save_to_db(view_event_action)
    return [view_event_action]
Ejemplo n.º 13
0
    def test_event_exported(self):
        """Method to test the actions associated with a notification about an event being successfully exported."""

        with self.app.test_request_context():
            request_url = 'https://localhost/some/path/image.png'
            response = get_event_exported_actions(request_url)
            expected_action = NotificationAction(subject='event-export',
                                                 link=request_url,
                                                 action_type='download')
            expected_action = [expected_action]
            expected_length = len(expected_action)
            response_length = len(response)
            self.assertIsInstance(response, list)
            self.assertEqual(expected_action[0].subject, response[0].subject)
            self.assertEqual(expected_length, response_length)
    def test_ticket_purchased_attendee(self):
        """Method to test the actions associated with a notification of tickets purchased for an attendee that is
           not the buyer."""

        with self.app.test_request_context():
            request_pdfurl = 'https://localhost/pdf/e/24324/'
            response = get_ticket_purchased_attendee_notification_actions(request_pdfurl)
            expected_action = NotificationAction(
                subject='tickets-pdf', link=request_pdfurl, action_type='view'
            )
            expected_action = [expected_action]
            expected_length = len(expected_action)
            response_length = len(response)
            self.assertIsInstance(response, list)
            self.assertEqual(expected_action[0].subject, response[0].subject)
            self.assertEqual(expected_length, response_length)
Ejemplo n.º 15
0
    def test_event_role_notification(self):
        """Method to test the actions associated with a notification of an event role."""

        with self.app.test_request_context():
            request_url = 'https://localhost/e/345525/invitation'
            request_event_id = 1
            response = get_event_role_notification_actions(
                request_event_id, request_url)
            expected_action = NotificationAction(subject='event-role',
                                                 subject_id=request_event_id,
                                                 link=request_url,
                                                 action_type='view')
            expected_action = [expected_action]
            expected_length = len(expected_action)
            response_length = len(response)
            self.assertIsInstance(response, list)
            self.assertEqual(expected_action[0].subject, response[0].subject)
            self.assertEqual(expected_length, response_length)
Ejemplo n.º 16
0
    def test_monthly_pay_followup_notification(self):
        """Method to test the actions associated with a follow up notification of monthly payments."""

        with self.app.test_request_context():
            request_url = 'https://localhost/e/345525/payment'
            request_event_id = 1
            response = get_monthly_payment_follow_up_notification_actions(
                request_event_id, request_url)
            expected_action = NotificationAction(subject='invoice',
                                                 link=request_url,
                                                 subject_id=request_event_id,
                                                 action_type='view')
            expected_action = [expected_action]
            expected_length = len(expected_action)
            response_length = len(response)
            self.assertIsInstance(response, list)
            self.assertEqual(expected_action[0].subject, response[0].subject)
            self.assertEqual(expected_length, response_length)
Ejemplo n.º 17
0
    def test_ticket_purchased_notification(self):
        """Method to test the actions associated with a notification of tickets purchased."""

        with self.app.test_request_context():
            request_url = 'https://localhost/e/345525/order'
            request_order_id = 1
            response = get_ticket_purchased_notification_actions(
                request_order_id, request_url)
            expected_action = NotificationAction(subject='order',
                                                 link=request_url,
                                                 subject_id=request_order_id,
                                                 action_type='view')
            expected_action = [expected_action]
            expected_length = len(expected_action)
            response_length = len(response)
            self.assertIsInstance(response, list)
            self.assertEqual(expected_action[0].subject, response[0].subject)
            self.assertEqual(expected_length, response_length)
Ejemplo n.º 18
0
    def test_session_accept_reject_notif(self):
        """Method to test the actions associated with a notification of a session getting accepted/rejected."""

        with self.app.test_request_context():
            request_url = 'https://localhost/e/session/345525'
            request_session_id = 1
            response = get_session_accept_reject_notification_actions(
                request_session_id, request_url)
            expected_action = NotificationAction(subject='session',
                                                 link=request_url,
                                                 subject_id=request_session_id,
                                                 action_type='view')
            expected_action = [expected_action]
            expected_length = len(expected_action)
            response_length = len(response)
            self.assertIsInstance(response, list)
            self.assertEqual(expected_action[0].subject, response[0].subject)
            self.assertEqual(expected_length, response_length)
Ejemplo n.º 19
0
    def test_event_imported(self):
        """Method to test the actions associated with a notification about an event being successfully exported."""

        with app.test_request_context():
            request_url = 'https://localhost/e/345525'
            request_event_id = 1
            response = get_event_imported_actions(request_event_id, request_url)
            expected_action = NotificationAction(
                # subject is still 'event' since the action will be to view the imported event.
                subject='event',
                link=request_url,
                subject_id=request_event_id,
                action_type='view'
            )
            expected_action = [expected_action]
            expected_length = len(expected_action)
            response_length = len(response)
            self.assertIsInstance(response, list)
            self.assertEqual(expected_action[0].subject, response[0].subject)
            self.assertEqual(expected_length, response_length)