Exemplo n.º 1
0
 def setUp(self):
     """
     start up stuff
     """
     startup.initialize()
     self.purge_notifications_timer_name = 'purge-notifications-timer'
     self.store = notification_store()
Exemplo n.º 2
0
def startup_notification_subsystem():
    """
    Initialize the Notification subsystem
    """
    try:
        startup.initialize()

        # register the scope resolvers that the runtime will be providing
        # to edx-notifications
        register_user_scope_resolver('course_enrollments',
                                     CourseEnrollmentsScopeResolver())
        register_user_scope_resolver('course_group',
                                     CourseGroupScopeResolver())
        register_user_scope_resolver('group_project_participants',
                                     GroupProjectParticipantsScopeResolver())
        register_user_scope_resolver('group_project_workgroup',
                                     GroupProjectParticipantsScopeResolver())
        register_user_scope_resolver('user_email_resolver',
                                     StudentEmailScopeResolver())

        # register namespace resolver
        register_namespace_resolver(CourseNamespaceResolver())
    except Exception, ex:
        # Note this will fail when we try to run migrations as manage.py will call startup.py
        # and startup.initialze() will try to manipulate some database tables.
        # We need to research how to identify when we are being started up as part of
        # a migration script
        log.error(
            'There was a problem initializing notifications subsystem. '
            'This could be because the database tables have not yet been created and '
            './manage.py lms syncdb needs to run setup.py. Error was "{err_msg}". Continuing...'
            .format(err_msg=str(ex)))
Exemplo n.º 3
0
def startup_notification_subsystem():
    """
    Initialize the Notification subsystem
    """
    try:
        startup.initialize()

        # register the scope resolvers that the runtime will be providing
        # to edx-notifications
        register_user_scope_resolver('course_enrollments', CourseEnrollmentsScopeResolver())
        register_user_scope_resolver('course_group', CourseGroupScopeResolver())
        register_user_scope_resolver('group_project_participants', GroupProjectParticipantsScopeResolver())
        register_user_scope_resolver('group_project_workgroup', GroupProjectParticipantsScopeResolver())
        register_user_scope_resolver('user_email_resolver', StudentEmailScopeResolver())

        # register namespace resolver
        register_namespace_resolver(CourseNamespaceResolver())
    except Exception, ex:
        # Note this will fail when we try to run migrations as manage.py will call startup.py
        # and startup.initialze() will try to manipulate some database tables.
        # We need to research how to identify when we are being started up as part of
        # a migration script
        log.error(
            'There was a problem initializing notifications subsystem. '
            'This could be because the database tables have not yet been created and '
            './manage.py lms syncdb needs to run setup.py. Error was "{err_msg}". Continuing...'.format(err_msg=str(ex))
        )
Exemplo n.º 4
0
 def setUp(self):
     """
     start up stuff
     """
     startup.initialize()
     self.purge_notifications_timer_name = 'purge-notifications-timer'
     self.store = notification_store()
Exemplo n.º 5
0
 def setUp(self):
     """
     start up stuff
     """
     startup.initialize()
     self.daily_digest_timer_name = 'daily-digest-timer'
     self.weekly_digest_timer_name = 'weekly-digest-timer'
     self.store = notification_store()
Exemplo n.º 6
0
    def test_signal_raised(self):
        """
        Verifies that a signal has been raised
        """

        startup.initialize()

        self.assertTrue(_SIGNAL_RAISED)
Exemplo n.º 7
0
 def setUp(self):
     """
     start up stuff
     """
     startup.initialize()
     self.daily_digest_timer_name = 'daily-digest-timer'
     self.weekly_digest_timer_name = 'weekly-digest-timer'
     self.store = notification_store()
Exemplo n.º 8
0
 def setUp(self):
     """
     Sets up test environments
     """
     startup.initialize()
     self.msg_type = NotificationType(
         name='open-edx.studio.announcements.new-announcement',
         renderer='edx_notifications.openedx.course_announcements.NewCourseAnnouncementRenderer'
     )
     register_notification_type(self.msg_type)
     self.msg = NotificationMessage(
         namespace='foo/bar/baz',
         msg_type=self.msg_type,
         payload=CANNED_TEST_PAYLOAD['open-edx.studio.announcements.new-announcement']
     )
Exemplo n.º 9
0
    def setUp(self):
        """
        Test setup
        """

        startup.initialize(register_system_types=False)

        self.msg_type = NotificationType(
            name='open-edx.edx_notifications.lib.tests.test_publisher',
            renderer='edx_notifications.renderers.basic.JsonRenderer',
        )
        register_notification_type(self.msg_type)

        self.msg = NotificationMessage(namespace='test-runner',
                                       msg_type=self.msg_type,
                                       payload={
                                           'foo': 'bar',
                                           'one': 'two'
                                       })
    def setUp(self):
        """
        Test setup
        """
        startup.initialize()
        register_user_scope_resolver('user_email_resolver', TestUserResolver())
        self.store = notification_store()

        self.msg_type = self.store.get_notification_type(name='open-edx.lms.discussions.reply-to-thread')

        self.msg = NotificationMessage(
            namespace='test-runner',
            msg_type=self.msg_type,
            payload={
                '_schema_version': 1,
                '_click_link': 'http://localhost',
                'original_poster_id': 1,
                'action_username': '******',
                'thread_title': 'A demo posting to the discussion forums',
            }
        )
Exemplo n.º 11
0
    def setUp(self):
        """
        Test setup
        """

        startup.initialize(register_system_types=False)

        self.msg_type = NotificationType(
            name='open-edx.edx_notifications.lib.tests.test_publisher',
            renderer='edx_notifications.renderers.basic.JsonRenderer',
        )
        register_notification_type(self.msg_type)

        self.msg = NotificationMessage(
            namespace='test-runner',
            msg_type=self.msg_type,
            payload={
                'foo': 'bar',
                'one': 'two'
            }
        )
    def setUp(self):
        """
        Test setup
        """
        startup.initialize()
        register_user_scope_resolver("user_email_resolver", TestUserResolver())
        self.store = notification_store()

        self.msg_type = self.store.get_notification_type(name="open-edx.lms.discussions.reply-to-thread")

        self.msg = NotificationMessage(
            namespace="test-runner",
            msg_type=self.msg_type,
            payload={
                "_schema_version": 1,
                "_click_link": "http://localhost",
                "original_poster_id": 1,
                "action_username": "******",
                "thread_title": "A demo posting to the discussion forums",
            },
        )
Exemplo n.º 13
0
def start_up():
    """
    Initialize the Notification subsystem
    """

    startup.initialize()
Exemplo n.º 14
0
def start_up():
    """
    Initialize the Notification subsystem
    """

    startup.initialize()