• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python factories.ProjectFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_unresponded_assignments

    def test_unresponded_assignments(self):
        lst = Project.objects.unresponded_assignments(self.sample_course,
                                                      self.student_one)
        self.assertEquals(len(lst), 2)
        self.assertTrue(self.selection_assignment in lst)
        self.assertTrue(self.assignment in lst)

        # add a response & retry
        ProjectFactory.create(
            course=self.sample_course, author=self.student_one,
            policy='PublicEditorsAreOwners',
            parent=self.selection_assignment)

        lst = Project.objects.unresponded_assignments(self.sample_course,
                                                      self.student_one)
        self.assertEquals(len(lst), 1)
        self.assertTrue(self.assignment in lst)

        # add a response & retry
        ProjectFactory.create(
            course=self.sample_course, author=self.student_one,
            policy='PrivateEditorsAreOwners',
            parent=self.assignment)

        lst = Project.objects.unresponded_assignments(self.sample_course,
                                                      self.student_one)
        self.assertEquals(len(lst), 0)
开发者ID:c0cky,项目名称:mediathread,代码行数:27,代码来源:test_models.py


示例2: setUp

    def setUp(self):
        self.setup_sample_course()
        self.setup_alternate_course()

        # Sample Course Image Asset
        self.faculty_asset = AssetFactory.create(course=self.sample_course,
                                                 author=self.instructor_one,
                                                 primary_source='image')
        self.student_asset = AssetFactory.create(course=self.sample_course,
                                                 author=self.student_one,
                                                 primary_source='image')

        self.student_note1 = SherdNoteFactory(
            asset=self.faculty_asset, author=self.student_one,
            tags=',image1', body='student note on student asset')
        self.student_note2 = SherdNoteFactory(
            asset=self.student_asset, author=self.student_one,
            tags=',image2', body='student note on faculty asset')
        self.faculty_note1 = SherdNoteFactory(
            asset=self.faculty_asset, author=self.instructor_one,
            tags=',image3', body='faculty note on faculty asset')
        self.faculty_note2 = SherdNoteFactory(
            asset=self.student_asset, author=self.instructor_one,
            tags=',image4', body='faculty note on student asset')

        self.alt_asset = AssetFactory.create(course=self.alt_course,
                                             author=self.alt_student,
                                             primary_source='image')
        self.alt_note = SherdNoteFactory(
            asset=self.alt_asset, author=self.alt_student,
            tags=',image1', body='student note on student asset')

        self.faculty_composition = ProjectFactory.create(
            course=self.sample_course, author=self.instructor_one,
            policy='InstructorShared')
        self.student_composition = ProjectFactory.create(
            course=self.sample_course, author=self.student_one,
            policy='CourseProtected')
        self.assignment = ProjectFactory.create(
            course=self.sample_course, author=self.instructor_one,
            policy='CourseProtected', project_type='assignment')
        self.assignment_response = ProjectFactory.create(
            course=self.sample_course, author=self.student_one,
            policy='PrivateEditorsAreOwners', parent=self.assignment)

        self.alt_composition = ProjectFactory.create(
            course=self.alt_course, author=self.student_one,
            policy='CourseProtected')

        self.discussion = self.create_discussion(
            self.sample_course, self.instructor_one)
        self.comment = self.add_comment(self.discussion, self.student_one)

        self.alt_discussion = self.create_discussion(
            self.alt_course, self.alt_instructor)
        self.alt_comment = self.add_comment(self.alt_discussion,
                                            self.alt_student)

        self.superuser = UserFactory(is_superuser=True, is_staff=True)
        self.add_as_faculty(self.sample_course, self.superuser)
开发者ID:c0cky,项目名称:mediathread,代码行数:60,代码来源:test_views.py


示例3: setUp

    def setUp(self):
        self.setup_sample_course()

        self.assignment1 = ProjectFactory.create(
            title='Alpha', course=self.sample_course,
            author=self.instructor_one, policy='CourseProtected',
            project_type='assignment')

        self.response1 = ProjectFactory.create(
            title="Response 1",
            course=self.sample_course, author=self.student_one,
            policy='InstructorShared', parent=self.assignment1)

        self.asset = AssetFactory(course=self.sample_course)
        SherdNote.objects.global_annotation(
            self.asset, self.student_one, auto_create=True)
        self.student_one_selection1 = SherdNoteFactory(
            asset=self.asset, author=self.student_one,
            tags=',student_one_selection',
            title="Selection", range1=116.25, range2=6.75)
        self.student_one_selection2 = SherdNoteFactory(
            asset=self.asset, author=self.student_one,
            title="Selection", range1=116.25, range2=6.75)
        self.student_two_selection = SherdNoteFactory(
            asset=self.asset, author=self.student_two,
            title="Selection", range1=16.25, range2=2.75)

        self.add_citation(self.response1, self.student_one_selection1)
        self.add_citation(self.response1, self.student_two_selection)
开发者ID:ccnmtl,项目名称:mediathread,代码行数:29,代码来源:test_views.py


示例4: test_migrate_materials_sample_course

    def test_migrate_materials_sample_course(self):
        self.project1 = ProjectFactory.create(course=self.sample_course,
                                              author=self.instructor_one,
                                              policy='PrivateEditorsAreOwners')
        self.project2 = ProjectFactory.create(course=self.sample_course,
                                              author=self.instructor_one,
                                              policy='CourseProtected',
                                              project_type='assignment')

        self.assertTrue(self.client.login(
            username=self.instructor_three.username,
            password="test"))

        set_course_url = '/?set_course=%s&next=/' % \
            self.sample_course.group.name
        response = self.client.get(set_course_url, follow=True)
        self.assertEquals(response.status_code, 200)

        url = '/dashboard/migrate/materials/%s/' % self.sample_course.id

        response = self.client.get(url, {},
                                   HTTP_X_REQUESTED_WITH='XMLHttpRequest')
        self.assertEquals(response.status_code, 200)

        the_json = json.loads(response.content)
        self.assertEquals(the_json['course']['title'], 'Sample Course')
        self.assertEquals(len(the_json['assets']), 1)

        self.assertEquals(the_json['assets'][0]['title'],
                          self.asset1.title)
        self.assertEquals(the_json['assets'][0]['annotation_count'], 1)

        self.assertEquals(len(the_json['projects']), 1)
        self.assertEquals(the_json['projects'][0]['title'],
                          self.project2.title)
开发者ID:c0cky,项目名称:mediathread,代码行数:35,代码来源:test_views.py


示例5: setUp

    def setUp(self):
        self.setup_sample_course()

        self.assignment = ProjectFactory.create(
            course=self.sample_course,
            author=self.instructor_one,
            policy=PUBLISH_WHOLE_CLASS[0],
            project_type="selection-assignment",
        )

        self.asset = AssetFactory.create(course=self.sample_course, primary_source="image")
        self.assets = Asset.objects.filter(id=self.asset.id)

        AssignmentItemFactory.create(project=self.assignment, asset=self.asset)

        self.response_one = ProjectFactory.create(
            course=self.sample_course, author=self.student_one, policy="PrivateEditorsAreOwners", parent=self.assignment
        )
        self.note_one = SherdNoteFactory(
            asset=self.asset, author=self.student_one, body="student one selection note", range1=0, range2=1
        )
        ProjectNoteFactory(project=self.response_one, annotation=self.note_one)

        self.response_two = ProjectFactory.create(
            course=self.sample_course, author=self.student_two, policy="PrivateEditorsAreOwners", parent=self.assignment
        )
        self.note_two = SherdNoteFactory(
            asset=self.asset, author=self.student_one, body="student one selection note", range1=0, range2=1
        )
        ProjectNoteFactory(project=self.response_two, annotation=self.note_two)

        self.mixin = RestrictedMaterialsMixin()
        self.mixin.request = RequestFactory().get("/")
        self.mixin.request.course = self.sample_course
开发者ID:ccnmtl,项目名称:mediathread,代码行数:34,代码来源:test_mixins.py


示例6: test_responses_for_bad_assignment_state

    def test_responses_for_bad_assignment_state(self):
        ProjectFactory.create(
            course=self.sample_course, author=self.student_one,
            policy=PUBLISH_INSTRUCTOR_SHARED[0], parent=self.assignment)
        self.assignment.get_collaboration().delete()

        r = self.assignment.responses(self.sample_course, self.instructor_one)
        self.assertEquals(len(r), 0)
开发者ID:ccnmtl,项目名称:mediathread,代码行数:8,代码来源:test_models.py


示例7: setUp

    def setUp(self):
        self.setup_sample_course()

        self.asset1 = AssetFactory(course=self.sample_course)
        global_annotation, created = SherdNote.objects.global_annotation(
            self.asset1, self.student_three, auto_create=True
        )
        self.assertTrue(global_annotation.is_global_annotation())

        whole_item_annotation = SherdNoteFactory(
            asset=self.asset1, author=self.student_three, title="Whole Item Selection", range1=0, range2=0
        )
        self.assertFalse(whole_item_annotation.is_global_annotation())

        real_annotation = SherdNoteFactory(
            asset=self.asset1, author=self.student_three, title="Selection", range1=116.25, range2=6.75
        )
        self.assertFalse(real_annotation.is_global_annotation())

        self.assignment1 = ProjectFactory.create(
            title="Alpha",
            course=self.sample_course,
            author=self.instructor_one,
            policy="CourseProtected",
            project_type="assignment",
        )

        self.response1 = ProjectFactory.create(
            title="Response 1",
            course=self.sample_course,
            author=self.student_one,
            policy="InstructorShared",
            parent=self.assignment1,
        )
        self.response2 = ProjectFactory.create(
            title="Response 2",
            date_submitted=datetime.now(),
            course=self.sample_course,
            author=self.student_two,
            policy="InstructorShared",
            parent=self.assignment1,
        )

        self.assignment2 = ProjectFactory.create(
            title="Beta",
            course=self.sample_course,
            author=self.instructor_one,
            policy="CourseProtected",
            project_type="assignment",
        )

        self.project = ProjectFactory(
            title="Gamma", course=self.sample_course, author=self.instructor_one, policy="CourseProtected"
        )

        self.add_citation(self.project, global_annotation)
        self.add_citation(self.project, whole_item_annotation)
        self.add_citation(self.project, real_annotation)
开发者ID:c0cky,项目名称:mediathread,代码行数:58,代码来源:test_views.py


示例8: test_faculty_compositions

    def test_faculty_compositions(self):
        compositions = Project.objects.faculty_compositions(
            self.sample_course, self.student_one)
        self.assertEquals(len(compositions), 0)

        # instructor composition
        ProjectFactory.create(
            course=self.sample_course, author=self.instructor_one,
            policy='CourseProtected')

        compositions = Project.objects.faculty_compositions(
            self.sample_course, self.student_one)
        self.assertEquals(len(compositions), 1)
开发者ID:avorio,项目名称:mediathread,代码行数:13,代码来源:test_model.py


示例9: test_responses

    def test_responses(self):
        response1 = ProjectFactory.create(
            course=self.sample_course, author=self.student_one,
            policy='InstructorShared', parent=self.assignment)
        ProjectFactory.create(
            course=self.sample_course, author=self.student_two,
            policy='InstructorShared', parent=self.assignment)

        r = self.assignment.responses(self.sample_course, self.instructor_one)
        self.assertEquals(len(r), 2)

        r = self.assignment.responses_by(self.sample_course,
                                         self.instructor_one,
                                         self.student_one)
        self.assertEquals(r[0], response1)
开发者ID:avorio,项目名称:mediathread,代码行数:15,代码来源:test_model.py


示例10: test_course_protected

    def test_course_protected(self):
        policy = CourseProtected()

        course = self.sample_course

        project = ProjectFactory.create(
            course=self.sample_course, author=self.student_one,
            policy='CourseProtected')
        collaboration = Collaboration.objects.get_for_object(project)

        user = self.student_one
        self.assertTrue(policy.read(collaboration, course, user))
        self.assertTrue(policy.edit(collaboration, course, user))
        self.assertTrue(policy.manage(collaboration, course, user))
        self.assertTrue(policy.delete(collaboration, course, user))

        user = self.student_two
        self.assertTrue(policy.read(collaboration, course, user))
        self.assertFalse(policy.edit(collaboration, course, user))
        self.assertFalse(policy.manage(collaboration, course, user))
        self.assertFalse(policy.delete(collaboration, course, user))

        user = self.instructor_one
        self.assertTrue(policy.read(collaboration, course, user))
        self.assertFalse(policy.edit(collaboration, course, user))
        self.assertFalse(policy.manage(collaboration, course, user))
        self.assertFalse(policy.delete(collaboration, course, user))
开发者ID:c0cky,项目名称:mediathread,代码行数:27,代码来源:test_policies.py


示例11: test_collaboration_sync_model

    def test_collaboration_sync_model(self):
        project = ProjectFactory.create(
            course=self.sample_course, author=self.student_one)

        collaboration = project.get_collaboration()
        self.assertEquals(collaboration.policy_record.policy_name,
                          'PrivateEditorsAreOwners')

        project.collaboration_sync_group(collaboration)
        self.assertIsNotNone(collaboration.group)
        users = collaboration.group.user_set.all()
        self.assertEquals(users.count(), 1)
        self.assertTrue(self.student_one in users)

        # add some participants
        project.participants.add(self.student_two)
        project.collaboration_sync_group(collaboration)
        self.assertIsNotNone(collaboration.group)
        users = collaboration.group.user_set.all()
        self.assertEquals(users.count(), 2)
        self.assertTrue(self.student_one in users)
        self.assertTrue(self.student_two in users)

        # remove some participants
        project.participants.remove(self.student_two)
        project.collaboration_sync_group(collaboration)
        self.assertIsNotNone(collaboration.group)
        users = collaboration.group.user_set.all()
        self.assertEquals(users.count(), 1)
        self.assertTrue(self.student_one in users)
        self.assertFalse(self.student_two in users)
开发者ID:avorio,项目名称:mediathread,代码行数:31,代码来源:test_model.py


示例12: setUp

    def setUp(self):
        self.setup_sample_course()
        self.setup_alternate_course()

        # Sample Course Image Asset
        self.asset1 = AssetFactory.create(course=self.sample_course,
                                          primary_source='image')

        self.student_note = SherdNoteFactory(
            asset=self.asset1, author=self.student_one,
            tags=',student_one_selection',
            body='student one selection note', range1=0, range2=1)
        self.student_ga = SherdNoteFactory(
            asset=self.asset1, author=self.student_one,
            tags=',student_one_item',
            body='student one item note',
            title=None, range1=None, range2=None)
        self.instructor_note = SherdNoteFactory(
            asset=self.asset1, author=self.instructor_one,
            tags=',image, instructor_one_selection,',
            body='instructor one selection note', range1=0, range2=1)
        self.instructor_ga = SherdNoteFactory(
            asset=self.asset1, author=self.instructor_one,
            tags=',image, instructor_one_item,',
            body='instructor one item note',
            title=None, range1=None, range2=None)

        # Sample Course Projects
        self.project_private = ProjectFactory.create(
            course=self.sample_course, author=self.student_one,
            policy='PrivateEditorsAreOwners')

        self.project_instructor_shared = ProjectFactory.create(
            course=self.sample_course, author=self.student_one,
            policy='InstructorShared')

        self.project_class_shared = ProjectFactory.create(
            course=self.sample_course, author=self.student_one,
            policy='CourseProtected')

        self.assignment = ProjectFactory.create(
            course=self.sample_course, author=self.instructor_one,
            policy='Assignment')
        self.add_citation(self.assignment, self.student_note)
        self.add_citation(self.assignment, self.instructor_note)
        self.add_citation(self.assignment, self.student_ga)
        self.add_citation(self.assignment, self.instructor_ga)
开发者ID:avorio,项目名称:mediathread,代码行数:47,代码来源:test_model.py


示例13: test_append_remove_child

    def test_append_remove_child(self):
        parent = ProjectFactory.create(
            course=self.sample_course, author=self.instructor_one, policy="CourseProtected", project_type="assignment"
        )

        response = ProjectFactory.create(
            course=self.sample_course, author=self.student_one, policy="PrivateEditorsAreOwners"
        )

        parent.get_collaboration().append_child(response)

        collaboration = response.get_collaboration()
        self.assertEquals(collaboration.get_parent().content_object, parent)

        parent.get_collaboration().remove_children()
        collaboration.refresh_from_db()
        self.assertIsNone(collaboration.get_parent())
开发者ID:c0cky,项目名称:mediathread,代码行数:17,代码来源:test_models.py


示例14: test_reset_publish_to_world

    def test_reset_publish_to_world(self):
        public = ProjectFactory.create(
            course=self.sample_course, author=self.student_one,
            policy='PublicEditorsAreOwners')
        self.assertEquals(public.public_url(), '/s/collaboration/7/')

        Project.objects.reset_publish_to_world(self.sample_course)
        self.assertIsNone(public.public_url())
开发者ID:avorio,项目名称:mediathread,代码行数:8,代码来源:test_model.py


示例15: test_bound_assignment_form_with_responses

    def test_bound_assignment_form_with_responses(self):
        self.sample_course.add_detail(ALLOW_PUBLIC_COMPOSITIONS_KEY, 1)
        assignment = ProjectFactory.create(
            course=self.sample_course, author=self.student_one,
            policy=PUBLISH_WHOLE_CLASS[0],
            project_type=PROJECT_TYPE_ASSIGNMENT)
        ProjectFactory.create(
            course=self.sample_course, author=self.student_one,
            title="Student One Response",
            policy=PUBLISH_WHOLE_CLASS[0], parent=assignment)

        data = {}
        frm = ProjectForm(self.request, instance=assignment, data=data)
        self.assertEquals(frm.initial['publish'], PUBLISH_WHOLE_CLASS[0])

        lst = frm.fields['publish'].choices
        self.assertEquals(len(lst), 1)
        self.assertEquals(lst[0][0], PUBLISH_WHOLE_CLASS[0])
开发者ID:c0cky,项目名称:mediathread,代码行数:18,代码来源:test_forms.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tal.getTAL函数代码示例发布时间:2022-05-27
下一篇:
Python factories.AssetFactory类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap