def test_student_progress_stats_analytics_displays_on_dashboard(self):
        """Test analytics page on course dashboard."""

        with actions.OverriddenEnvironment(
            {'course': {
                analytics.CAN_RECORD_STUDENT_EVENTS: 'true'
            }}):

            student1 = '*****@*****.**'
            name1 = 'Test Student 1'
            student2 = '*****@*****.**'
            name2 = 'Test Student 2'

            # Student 1 completes a unit.
            actions.login(student1)
            actions.register(self, name1)
            actions.view_unit(self)
            actions.logout()

            # Student 2 completes a unit.
            actions.login(student2)
            actions.register(self, name2)
            actions.view_unit(self)
            actions.logout()

            # Admin logs back in and checks if progress exists.
            email = '*****@*****.**'
            actions.login(email, is_admin=True)
            response = self.get('dashboard?action=analytics_students')
            assert_contains('Google > Dashboard > Manage > Students',
                            response.body)
            assert_contains('have not been calculated yet', response.body)

            response = response.forms['gcb-generate-analytics-data'].submit(
            ).follow()
            assert len(self.taskq.GetTasks('default')) == (
                ProgressAnalyticsTest.EXPECTED_TASK_COUNT)

            response = self.get('dashboard?action=analytics_students')
            assert_contains('is running', response.body)

            self.execute_all_deferred_tasks()

            response = self.get('dashboard?action=analytics_students')
            assert_contains('were last updated at', response.body)
            assert_contains('currently enrolled: 2', response.body)
            assert_contains('total: 2', response.body)

            assert_contains('Student Progress', response.body)
            assert_does_not_contain(
                'No student progress has been recorded for this course.',
                response.body)
            # JSON code for the completion statistics.
            assert_contains(
                '\\"u.1.l.1\\": {\\"progress\\": 0, \\"completed\\": 2}',
                response.body)
            assert_contains(
                '\\"u.1\\": {\\"progress\\": 2, \\"completed\\": 0}',
                response.body)
Пример #2
0
    def test_student_progress_stats_analytics_displays_on_dashboard(self):
        """Test analytics page on course dashboard."""

        self.enable_progress_tracking()

        student1 = '*****@*****.**'
        name1 = 'Test Student 1'
        student2 = '*****@*****.**'
        name2 = 'Test Student 2'

        # Student 1 completes a unit.
        actions.login(student1)
        actions.register(self, name1)
        actions.view_unit(self)
        actions.logout()

        # Student 2 completes a unit.
        actions.login(student2)
        actions.register(self, name2)
        actions.view_unit(self)
        actions.logout()

        # Admin logs back in and checks if progress exists.
        email = '*****@*****.**'
        actions.login(email, is_admin=True)
        response = self.get('dashboard?action=analytics')
        assert_contains(
            'Google &gt;<a href="%s"> Dashboard </a>&gt; Analytics' %
                self.canonicalize('dashboard'),
            response.body)
        assert_contains('have not been calculated yet', response.body)

        compute_form = response.forms['gcb-compute-student-stats']
        response = self.submit(compute_form)
        assert_equals(response.status_int, 302)
        assert len(self.taskq.GetTasks('default')) == 5

        response = self.get('dashboard?action=analytics')
        assert_contains('is running', response.body)

        self.execute_all_deferred_tasks()

        response = self.get('dashboard?action=analytics')
        assert_contains('were last updated at', response.body)
        assert_contains('currently enrolled: 2', response.body)
        assert_contains('total: 2', response.body)

        assert_contains('Student Progress Statistics', response.body)
        assert_does_not_contain(
            'No student progress has been recorded for this course.',
            response.body)
        # JSON code for the completion statistics.
        assert_contains(
            '\\"u.1.l.1\\": {\\"progress\\": 0, \\"completed\\": 2}',
            response.body)
        assert_contains(
            '\\"u.1\\": {\\"progress\\": 2, \\"completed\\": 0}',
            response.body)
Пример #3
0
    def test_student_progress_stats_analytics_displays_on_dashboard(self):
        """Test analytics page on course dashboard."""

        with actions.OverriddenEnvironment(
            {'course': {analytics.CAN_RECORD_STUDENT_EVENTS: 'true'}}):

            student1 = '*****@*****.**'
            name1 = 'Test Student 1'
            student2 = '*****@*****.**'
            name2 = 'Test Student 2'

            # Student 1 completes a unit.
            actions.login(student1)
            actions.register(self, name1)
            actions.view_unit(self)
            actions.logout()

            # Student 2 completes a unit.
            actions.login(student2)
            actions.register(self, name2)
            actions.view_unit(self)
            actions.logout()

            # Admin logs back in and checks if progress exists.
            email = '*****@*****.**'
            actions.login(email, is_admin=True)
            response = self.get('dashboard?action=analytics_students')
            assert_contains(
                'Google &gt; Dashboard &gt; Manage &gt; Students',
                response.body)
            assert_contains('have not been calculated yet', response.body)

            response = response.forms[
                'gcb-generate-analytics-data'].submit().follow()
            assert len(self.taskq.GetTasks('default')) == (
                ProgressAnalyticsTest.EXPECTED_TASK_COUNT)

            response = self.get('dashboard?action=analytics_students')
            assert_contains('is running', response.body)

            self.execute_all_deferred_tasks()

            response = self.get('dashboard?action=analytics_students')
            assert_contains('were last updated at', response.body)
            assert_contains('currently enrolled: 2', response.body)
            assert_contains('total: 2', response.body)

            assert_contains('Student Progress', response.body)
            assert_does_not_contain(
                'No student progress has been recorded for this course.',
                response.body)
            # JSON code for the completion statistics.
            assert_contains(
                '\\"u.1.l.1\\": {\\"progress\\": 0, \\"completed\\": 2}',
                response.body)
            assert_contains(
                '\\"u.1\\": {\\"progress\\": 2, \\"completed\\": 0}',
                response.body)
Пример #4
0
    def test_student_progress_stats_analytics_displays_on_dashboard(self):
        """Test analytics page on course dashboard."""

        self.enable_progress_tracking()

        student1 = '*****@*****.**'
        name1 = 'Test Student 1'
        student2 = '*****@*****.**'
        name2 = 'Test Student 2'

        # Student 1 completes a unit.
        actions.login(student1)
        actions.register(self, name1)
        actions.view_unit(self)
        actions.logout()

        # Student 2 completes a unit.
        actions.login(student2)
        actions.register(self, name2)
        actions.view_unit(self)
        actions.logout()

        # Admin logs back in and checks if progress exists.
        email = '*****@*****.**'
        actions.login(email, is_admin=True)
        response = self.get('dashboard?action=analytics')
        assert_contains(
            'Google &gt; Dashboard &gt; Analytics', response.body)
        assert_contains('have not been calculated yet', response.body)

        compute_form = response.forms['gcb-compute-student-stats']
        response = self.submit(compute_form)
        assert_equals(response.status_int, 302)
        assert len(self.taskq.GetTasks('default')) == 4

        response = self.get('dashboard?action=analytics')
        assert_contains('is running', response.body)

        self.execute_all_deferred_tasks()

        response = self.get('dashboard?action=analytics')
        assert_contains('were last updated at', response.body)
        assert_contains('currently enrolled: 2', response.body)
        assert_contains('total: 2', response.body)

        assert_contains('Student Progress Statistics', response.body)
        assert_does_not_contain(
            'No student progress has been recorded for this course.',
            response.body)
        # JSON code for the completion statistics.
        assert_contains(
            '\\"u.1.l.1\\": {\\"progress\\": 0, \\"completed\\": 2}',
            response.body)
        assert_contains(
            '\\"u.1\\": {\\"progress\\": 2, \\"completed\\": 0}',
            response.body)
Пример #5
0
    def test_two_students_dont_see_each_other_pages(self):
        """Test a user can't see another user pages."""
        email1 = '*****@*****.**'
        name1 = 'User 1'
        email2 = '*****@*****.**'
        name2 = 'User 2'

        # Login as one user and view 'unit' and other pages, which are not
        # cached.
        actions.login(email1)
        actions.register(self, name1)
        actions.Permissions.assert_enrolled(self)
        response = actions.view_unit(self)
        assert_contains(email1, response.body)
        actions.logout()

        # Login as another user and check that 'unit' and other pages show
        # the correct new email.
        actions.login(email2)
        actions.register(self, name2)
        actions.Permissions.assert_enrolled(self)
        response = actions.view_unit(self)
        assert_contains(email2, response.body)
        actions.logout()
Пример #6
0
    def test_two_students_dont_see_each_other_pages(self):
        """Test a user can't see another user pages."""
        email1 = '*****@*****.**'
        name1 = 'User 1'
        email2 = '*****@*****.**'
        name2 = 'User 2'

        # Login as one user and view 'unit' and other pages, which are not
        # cached.
        actions.login(email1)
        actions.register(self, name1)
        actions.Permissions.assert_enrolled(self)
        response = actions.view_unit(self)
        assert_contains(email1, response.body)
        actions.logout()

        # Login as another user and check that 'unit' and other pages show
        # the correct new email.
        actions.login(email2)
        actions.register(self, name2)
        actions.Permissions.assert_enrolled(self)
        response = actions.view_unit(self)
        assert_contains(email2, response.body)
        actions.logout()