当前位置: 首页>>代码示例>>Python>>正文


Python actions.logout函数代码示例

本文整理汇总了Python中tests.functional.actions.logout函数的典型用法代码示例。如果您正苦于以下问题:Python logout函数的具体用法?Python logout怎么用?Python logout使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了logout函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_student_cannot_see_reviews_prematurely

    def test_student_cannot_see_reviews_prematurely(self):
        """Test that students cannot see others' reviews prematurely."""

        email = '[email protected]'
        name = 'Student 1'
        submission = transforms.dumps([
            {'index': 0, 'type': 'regex', 'value': 'S1-1', 'correct': True},
            {'index': 1, 'type': 'choices', 'value': 3, 'correct': False},
            {'index': 2, 'type': 'regex', 'value': 'is-S1', 'correct': True},
        ])
        payload = {
            'answers': submission, 'assessment_type': LEGACY_REVIEW_UNIT_ID}

        actions.login(email)
        actions.register(self, name)
        response = actions.submit_assessment(
            self, LEGACY_REVIEW_UNIT_ID, payload)

        # Student 1 cannot see the reviews for his assignment yet, because he
        # has not submitted the two required reviews.
        response = self.get('assessment?name=%s' % LEGACY_REVIEW_UNIT_ID)
        actions.assert_equals(response.status_int, 200)
        actions.assert_contains('Due date for this assignment', response.body)
        actions.assert_contains(
            'After you have completed the required number of peer reviews',
            response.body)

        actions.logout()
开发者ID:2023SS,项目名称:coursebuilder-core,代码行数:28,代码来源:controllers_tests.py

示例2: test_guide_enabled_course

    def test_guide_enabled_course(self):
        with actions.OverriddenEnvironment(self.GUIDE_ENABLED_COURSE):
            actions.logout()
            self.assert_guide_accesssible("Alpha")
            self.assert_guide_accesssible("Bravo")
            self.assert_guide_not_accesssible("Charlie", is_guides_accessible=True)
            self.assert_guide_not_accesssible("Delta", is_guides_accessible=True)

            actions.login("[email protected]")
            self.assert_guide_accesssible("Alpha")
            self.assert_guide_accesssible("Bravo")
            self.assert_guide_not_accesssible("Charlie", is_guides_accessible=True)
            self.assert_guide_not_accesssible("Delta", is_guides_accessible=True)

            self.register("Charlie")
            self.assert_guide_accesssible("Alpha")
            self.assert_guide_accesssible("Bravo")
            self.assert_guide_accesssible("Charlie")
            self.assert_guide_not_accesssible("Delta", is_guides_accessible=True)

            actions.login("[email protected]", is_admin=True)
            for name in ["Alpha", "Bravo", "Charlie", "Delta"]:
                self.assert_guide_accesssible(name)

            # check course labels as admin sees them
            response = self.get("/modules/guides")
            self.assertEquals(200, response.status_int)
            self.assertIn('category="Power Searching with Google [Alpha]', response.body)
            self.assertIn('category="Power Searching with Google [Bravo]', response.body)
            self.assertIn('category="Power Searching with Google [Charlie] ' "(Registration required)", response.body)
            self.assertIn('category="Power Searching with Google [Delta] (Private)', response.body)
开发者ID:gbaldera,项目名称:coursebuilder-core,代码行数:31,代码来源:guide_tests.py

示例3: test_not_from_cron_and_not_admin

 def test_not_from_cron_and_not_admin(self):
     config.set_report_allowed(True)
     actions.logout()
     response = self.get(usage_reporting.StartReportingJobs.URL,
                         expect_errors=True)
     self.assertEquals(403, response.status_int)
     self.assertEquals('Forbidden.', response.body)
开发者ID:google,项目名称:coursebuilder-core,代码行数:7,代码来源:usage_reporting_tests.py

示例4: test_not_logged_in

 def test_not_logged_in(self):
     actions.logout()
     response = self.get(UNIT_PROGRESS_URL +
                         '?key=%s' % self._unit_one.unit_id)
     self._expect_response(
         response, 403,
         'Bad XSRF token. Please reload the page and try again')
开发者ID:2023SS,项目名称:coursebuilder-core,代码行数:7,代码来源:manual_progress_tests.py

示例5: setUp

    def setUp(self):
        super(RolesTest, self).setUp()

        actions.login(COURSE_ADMIN_EMAIL, is_admin=True)
        payload_dict = {
            'name': COURSE_NAME,
            'title': 'Roles Test',
            'admin_email': COURSE_ADMIN_EMAIL}
        request = {
            'payload': transforms.dumps(payload_dict),
            'xsrf_token': crypto.XsrfTokenManager.create_xsrf_token(
                'add-course-put')}
        response = self.testapp.put('/rest/courses/item?%s' % urllib.urlencode(
            {'request': transforms.dumps(request)}), {})
        self.assertEquals(response.status_int, 200)
        sites.setup_courses('course:/%s::ns_%s, course:/:/' % (
                COURSE_NAME, COURSE_NAME))
        actions.logout()

        config.Registry.test_overrides[roles.GCB_ADMIN_LIST.name] = (
            '[%s]' % SITE_ADMIN_EMAIL)

        # pylint: disable-msg=protected-access
        self.old_registered_permission = roles.Roles._REGISTERED_PERMISSIONS
        roles.Roles._REGISTERED_PERMISSIONS = {}

        config.Registry.test_overrides[models.CAN_USE_MEMCACHE.name] = True
开发者ID:CSCI1200Course,项目名称:csci1200OnlineCourse,代码行数:27,代码来源:roles.py

示例6: test_enrollment

    def test_enrollment(self):
        actions.logout()

        response = self.get_response(
            '{course(id: "%s") {enrollment {email enrolled}}}' % (
                self.course_id))
        enrollment = response['data']['course']['enrollment']
        self.assertEquals({'enrolled': False, 'email': None}, enrollment)

        actions.login(STUDENT_EMAIL)

        response = self.get_response(
            '{course(id: "%s") {enrollment {email enrolled}}}' % (
                self.course_id))
        enrollment = response['data']['course']['enrollment']
        self.assertEquals({'enrolled': False, 'email': None}, enrollment)

        actions.register(self, STUDENT_NAME)

        response = self.get_response(
            '{course (id: "%s") { enrollment { email enrolled}}}' % (
                self.course_id))
        enrollment = response['data']['course']['enrollment']
        self.assertEquals(
            {'enrolled': True, 'email': STUDENT_EMAIL}, enrollment)
开发者ID:google,项目名称:coursebuilder-core,代码行数:25,代码来源:gql_tests.py

示例7: test_lesson_access_title_only

    def test_lesson_access_title_only(self):
        actions.logout()

        self.unit.availability = courses.AVAILABILITY_AVAILABLE
        self.lesson.availability = courses.AVAILABILITY_UNAVAILABLE
        self.lesson.shown_when_unavailable = True
        self.course.save()
        expected_lesson = {'title': self.lesson.title, 'body': None}

        # Access single lesson
        response = self.get_response(
            '{course(id: "%s") {unit(id: "%s") {'
              'lesson(id: "%s") {title body}}}}' % (
                self.course_id, self.unit_id, self.lesson_id))
        _lesson = response['data']['course']['unit']['lesson']
        self.assertEquals(expected_lesson, _lesson)

        # Access lesson list
        response = self.get_response(
            '{course(id: "%s") {unit(id: "%s") {allLessons {edges {node {'
            '  ... on Lesson{title body}}}}}}}' % (
                self.course_id, self.unit_id))
        edges = response['data']['course']['unit']['allLessons']['edges']
        self.assertEquals(1, len(edges))
        self.assertEquals(expected_lesson, edges[0]['node'])
开发者ID:google,项目名称:coursebuilder-core,代码行数:25,代码来源:gql_tests.py

示例8: test_not_enough_assignments_to_allocate

    def test_not_enough_assignments_to_allocate(self):
        """Test for the case when there are too few assignments in the pool."""

        email = '[email protected]'
        name = 'Student 1'
        submission = transforms.dumps([
            {'index': 0, 'type': 'regex', 'value': 'S1-1', 'correct': True},
            {'index': 1, 'type': 'choices', 'value': 3, 'correct': False},
            {'index': 2, 'type': 'regex', 'value': 'is-S1', 'correct': True},
        ])
        payload = {
            'answers': submission, 'assessment_type': LEGACY_REVIEW_UNIT_ID}

        actions.login(email)
        actions.register(self, name)
        response = actions.submit_assessment(
            self, LEGACY_REVIEW_UNIT_ID, payload)

        # The student goes to the review dashboard and requests an assignment
        # to review -- but there is nothing to review.
        response = actions.request_new_review(
            self, LEGACY_REVIEW_UNIT_ID, expected_status_code=200)
        actions.assert_does_not_contain('Assignment to review', response.body)
        actions.assert_contains(
            'Sorry, there are no new submissions ', response.body)
        actions.assert_contains('disabled="true"', response.body)

        actions.logout()
开发者ID:2023SS,项目名称:coursebuilder-core,代码行数:28,代码来源:controllers_tests.py

示例9: setUp

    def setUp(self):
        super(StudentLabelsTest, self).setUp()
        actions.simple_add_course(COURSE_NAME, ADMIN_EMAIL, COURSE_TITLE)

        with common_utils.Namespace(NAMESPACE):
            self.foo_id = models.LabelDAO.save(models.LabelDTO(
                None, {'title': 'Foo',
                       'descripton': 'foo',
                       'type': models.LabelDTO.LABEL_TYPE_COURSE_TRACK}))
            self.bar_id = models.LabelDAO.save(models.LabelDTO(
                None, {'title': 'Bar',
                       'descripton': 'bar',
                       'type': models.LabelDTO.LABEL_TYPE_COURSE_TRACK}))
            self.baz_id = models.LabelDAO.save(models.LabelDTO(
                None, {'title': 'Baz',
                       'descripton': 'baz',
                       'type': models.LabelDTO.LABEL_TYPE_COURSE_TRACK}))
            self.quux_id = models.LabelDAO.save(models.LabelDTO(
                None, {'title': 'Quux',
                       'descripton': 'quux',
                       'type': models.LabelDTO.LABEL_TYPE_GENERAL}))

        actions.login(REGISTERED_STUDENT_EMAIL)
        actions.register(self, REGISTERED_STUDENT_NAME, COURSE_NAME)
        actions.logout()
开发者ID:barkinet,项目名称:course-builder,代码行数:25,代码来源:student_labels.py

示例10: test_availability_course

    def test_availability_course(self):
        course = self._init_course('test')
        env = self.enabled(availability=courses.AVAILABILITY_COURSE)

        for availability in [
                courses.COURSE_AVAILABILITY_PUBLIC,
                courses.COURSE_AVAILABILITY_REGISTRATION_OPTIONAL]:
            course.set_course_availability(availability)
            with actions.OverriddenEnvironment(env):
                actions.logout()
                self.assertPage('/test/foo/index.html', 'Web Server')
                self.assertPage('/test/foo/markdown.md', 'Web Server')
                self.assertPage('/test/foo/main.css', 'Web Server')

                actions.login('[email protected]')
                self.assertPage('/test/foo/index.html', 'Web Server')
                self.assertPage('/test/foo/markdown.md', 'Web Server')
                self.assertPage('/test/foo/main.css', 'Web Server')

                if availability == (
                        courses.COURSE_AVAILABILITY_REGISTRATION_OPTIONAL):
                    self.register()
                    self.assertPage('/test/foo/index.html', ' Web Server')
                    self.assertPage('/test/foo/markdown.md', ' Web Server')
                    self.assertPage('/test/foo/main.css', ' Web Server')
                    self.unregister()

                actions.login('[email protected]', is_admin=True)
                self.assertPage('/test/foo/index.html', ' Web Server')
                self.assertPage('/test/foo/markdown.md', ' Web Server')
                self.assertPage('/test/foo/main.css', ' Web Server')

        for availability in [
                courses.COURSE_AVAILABILITY_REGISTRATION_REQUIRED,
                courses.COURSE_AVAILABILITY_PRIVATE]:
            course.set_course_availability(availability)
            with actions.OverriddenEnvironment(env):
                actions.logout()
                self.assertNoPage('/test/foo/index.html')
                self.assertNoPage('/test/foo/markdown.md')
                self.assertNoPage('/test/foo/main.css')

                actions.login('[email protected]')
                self.assertNoPage('/test/foo/index.html')
                self.assertNoPage('/test/foo/markdown.md')
                self.assertNoPage('/test/foo/main.css')

                if availability == (
                        courses.COURSE_AVAILABILITY_REGISTRATION_REQUIRED):
                    self.register()
                    self.assertPage('/test/foo/index.html', ' Web Server')
                    self.assertPage('/test/foo/markdown.md', ' Web Server')
                    self.assertPage('/test/foo/main.css', ' Web Server')
                    self.unregister()

                actions.login('[email protected]', is_admin=True)
                self.assertPage('/test/foo/index.html', ' Web Server')
                self.assertPage('/test/foo/markdown.md', ' Web Server')
                self.assertPage('/test/foo/main.css', ' Web Server')
开发者ID:2023SS,项目名称:coursebuilder-core,代码行数:59,代码来源:webserv_tests.py

示例11: setUp

    def setUp(self):
        super(StudentTracksTest, self).setUp()

        # Add a course that will show up.
        actions.simple_add_course(COURSE_NAME, ADMIN_EMAIL, COURSE_TITLE)

        # Add labels
        with common_utils.Namespace(NAMESPACE):
            self.foo_id = models.LabelDAO.save(models.LabelDTO(
                None, {'title': 'Foo',
                       'descripton': 'foo',
                       'type': models.LabelDTO.LABEL_TYPE_COURSE_TRACK}))
            self.bar_id = models.LabelDAO.save(models.LabelDTO(
                None, {'title': 'Bar',
                       'descripton': 'bar',
                       'type': models.LabelDTO.LABEL_TYPE_COURSE_TRACK}))
            self.baz_id = models.LabelDAO.save(models.LabelDTO(
                None, {'title': 'Baz',
                       'descripton': 'baz',
                       'type': models.LabelDTO.LABEL_TYPE_COURSE_TRACK}))
            self.quux_id = models.LabelDAO.save(models.LabelDTO(
                None, {'title': 'Quux',
                       'descripton': 'quux',
                       'type': models.LabelDTO.LABEL_TYPE_GENERAL}))

        # Register a student for that course.
        actions.login(REGISTERED_STUDENT_EMAIL)
        actions.register(self, REGISTERED_STUDENT_NAME, COURSE_NAME)
        actions.logout()

        # Add some units to the course.
        self._course = courses.Course(
            None, app_context=sites.get_all_courses()[0])
        self._unit_no_labels = self._course.add_unit()
        self._unit_no_labels.title = 'Unit No Labels'
        self._unit_no_labels.availability = courses.AVAILABILITY_AVAILABLE
        self._course.add_lesson(self._unit_no_labels)
        self._unit_labels_foo = self._course.add_unit()
        self._unit_labels_foo.title = 'Unit Labels: Foo'
        self._unit_labels_foo.availability = courses.AVAILABILITY_AVAILABLE
        self._unit_labels_foo.labels = str(self.foo_id)
        self._course.add_lesson(self._unit_labels_foo)
        self._unit_labels_foo_bar = self._course.add_unit()
        self._unit_labels_foo_bar.title = 'Unit Labels: Bar, Foo'
        self._unit_labels_foo_bar.availability = courses.AVAILABILITY_AVAILABLE
        self._unit_labels_foo_bar.labels = '%s %s' % (self.bar_id, self.foo_id)
        self._course.add_lesson(self._unit_labels_foo_bar)
        self._unit_labels_quux = self._course.add_unit()
        self._unit_labels_quux.title = 'Unit Labels: Quux'
        self._unit_labels_quux.availability = courses.AVAILABILITY_AVAILABLE
        self._unit_labels_quux.labels = str(self.quux_id)
        self._course.add_lesson(self._unit_labels_quux)
        self._unit_labels_foo_quux = self._course.add_unit()
        self._unit_labels_foo_quux.title = 'Unit Labels: Foo Quux'
        self._unit_labels_foo_quux.availability = courses.AVAILABILITY_AVAILABLE
        self._unit_labels_foo_quux.labels = '%s %s' % (str(self.foo_id),
                                                       str(self.quux_id))
        self._course.add_lesson(self._unit_labels_foo_quux)
        self._course.save()
开发者ID:2023SS,项目名称:coursebuilder-core,代码行数:59,代码来源:student_tracks.py

示例12: test_handler_rejects_non_super_user

 def test_handler_rejects_non_super_user(self):
     actions.logout()
     xsrf_token = crypto.XsrfTokenManager.create_xsrf_token(self.XSRF_TOKEN)
     response = self.do_post(xsrf_token, False)
     self.assertEqual(200, response.status_int)
     response_dict = transforms.loads(response.body)
     self.assertEqual(401, response_dict['status'])
     self.assertIn('Access denied.', response_dict['message'])
开发者ID:barkinet,项目名称:course-builder,代码行数:8,代码来源:modules_usage_reporting.py

示例13: test_unsubscribe_request_with_no_email_prompts_for_login

 def test_unsubscribe_request_with_no_email_prompts_for_login(self):
     actions.logout()
     response = self.get('modules/unsubscribe')
     self.assertEquals(302, response.status_int)
     self.assertEquals(
         'https://www.google.com/accounts/Login'
         '?continue=http%3A//localhost/a/modules/unsubscribe',
         response.headers['Location'])
开发者ID:FilterKaapi,项目名称:course-builder,代码行数:8,代码来源:modules_unsubscribe.py

示例14: test_not_registered

 def test_not_registered(self):
     actions.logout()
     actions.login(UNREGISTERED_STUDENT_EMAIL)
     xsrf_token = crypto.XsrfTokenManager.create_xsrf_token(
         manual_progress.XSRF_ACTION)
     response = self.get(UNIT_PROGRESS_URL +
                         '?key=%s' % self._unit_one.unit_id +
                         '&xsrf_token=%s' % xsrf_token)
     self._expect_response(response, 401, 'Access Denied.')
开发者ID:2023SS,项目名称:coursebuilder-core,代码行数:9,代码来源:manual_progress_tests.py

示例15: test_cancel_import_not_admin

 def test_cancel_import_not_admin(self):
     actions.logout()
     response = self.post(self.dashboard_url, {
         'action':
             unit_lesson_editor.UnitLessonEditor.ACTION_POST_CANCEL_IMPORT,
         'xsrf_token': crypto.XsrfTokenManager.create_xsrf_token(
             unit_lesson_editor.UnitLessonEditor.ACTION_POST_CANCEL_IMPORT),
         })
     self.assertEquals(302, response.status_int)
开发者ID:danieldalonzo,项目名称:coursebuilder-core,代码行数:9,代码来源:courses_tests.py


注:本文中的tests.functional.actions.logout函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。