コード例 #1
0
ファイル: test_views.py プロジェクト: c0cky/mediathread
    def test_migrate_tags_and_notes(self):
        data = {
            'fromCourse': self.sample_course.id,
            'asset_ids[]': [self.asset1.id],
            'project_ids[]': [],
            'include_tags': 'true',
            'include_notes': 'true'
        }

        # Migrate assets from SampleCourse into Alternate Course
        # test_instructor_three is a member of both courses
        request = RequestFactory().post('/dashboard/migrate/', data)
        request.user = self.instructor_three
        request.course = self.alt_course

        view = MigrateCourseView()
        view.request = request
        view.post(request)

        new_asset = Asset.objects.get(course=self.alt_course,
                                      title=self.asset1.title)
        self.assertEquals(new_asset.sherdnote_set.count(), 2)

        note = new_asset.sherdnote_set.get(title=self.instructor_note.title)
        self.assertEquals(note.tags, self.instructor_note.tags)
        self.assertEquals(note.body, self.instructor_note.body)

        note = new_asset.global_annotation(self.instructor_three, False)
        self.assertEquals(
            note.tags,
            u',image, instructor_one_global,,instructor_two_global,')
        self.assertEquals(
            note.body,
            u'instructor one global noteinstructor two global note')
コード例 #2
0
ファイル: test_views.py プロジェクト: c0cky/mediathread
    def test_migrate_project(self):
        self.project1 = ProjectFactory.create(course=self.sample_course,
                                              author=self.instructor_one,
                                              policy='PublicEditorsAreOwners')

        self.add_citation(self.project1, self.instructor_note)
        self.add_citation(self.project1, self.student_note)
        self.assertEquals(len(self.project1.citations()), 2)

        data = {
            'fromCourse': self.sample_course.id,
            'asset_ids[]': [],
            'project_ids[]': [self.project1.id]
        }

        # Migrate assets from SampleCourse into Alternate Course
        # test_instructor_three is a member of both courses
        request = RequestFactory().post('/dashboard/migrate/', data)
        request.user = self.instructor_three
        request.course = self.alt_course

        view = MigrateCourseView()
        view.request = request
        response = view.post(request)

        the_json = json.loads(response.content)
        self.assertTrue(the_json['success'])
        self.assertEquals(the_json['asset_count'], 1)
        self.assertEquals(the_json['project_count'], 1)
        self.assertEquals(the_json['note_count'], 2)

        new_asset = Asset.objects.get(course=self.alt_course,
                                      title=self.asset1.title)
        self.assertEquals(new_asset.sherdnote_set.count(), 3)

        new_note = new_asset.sherdnote_set.get(title=self.student_note.title)
        self.assertEquals(new_note.author, self.instructor_three)

        new_note = new_asset.sherdnote_set.get(
            title=self.instructor_note.title)
        self.assertEquals(new_note.author, self.instructor_three)

        new_note = new_asset.sherdnote_set.get(title=None)
        self.assertEquals(new_note.author, self.instructor_three)
        self.assertTrue(new_note.is_global_annotation())

        new_project = Project.objects.get(
            course=self.alt_course, title=self.project1.title)
        self.assertEquals(len(new_project.citations()), 2)
コード例 #3
0
ファイル: test_views.py プロジェクト: c0cky/mediathread
    def test_post_on_behalf_of_faculty(self):
        data = {
            'fromCourse': self.alt_course.id,
            'on_behalf_of': self.alt_instructor.id
        }

        request = RequestFactory().post('/dashboard/migrate/', data)
        request.user = self.superuser
        request.course = self.sample_course

        view = MigrateCourseView()
        view.request = request
        response = view.post(request)

        the_json = json.loads(response.content)
        self.assertFalse(the_json['success'])
コード例 #4
0
    def test_post_on_behalf_of_faculty(self):
        teacher = User.objects.get(username='******')
        data = {
            'fromCourse': self.alt_course.id,
            'on_behalf_of': teacher.id
        }

        request = RequestFactory().post('/dashboard/migrate/', data)
        request.user = self.superuser
        request.course = self.sample_course

        view = MigrateCourseView()
        view.request = request
        response = view.post(request)

        the_json = json.loads(response.content)
        self.assertFalse(the_json['success'])
コード例 #5
0
ファイル: test_views.py プロジェクト: coati-00/mediathread
    def test_post_on_behalf_of_student(self):
        student = User.objects.get(username='******')
        data = {
            'fromCourse': self.alt_course.id,
            'on_behalf_of': student.id
        }

        request = RequestFactory().post('/dashboard/migrate/', data)
        request.user = self.superuser
        request.course = self.sample_course

        view = MigrateCourseView()
        view.request = request
        response = view.post(request)

        the_json = json.loads(response.content)
        self.assertFalse(the_json['success'])
コード例 #6
0
    def test_post(self):
        asset1 = Asset.objects.get(
            course=self.sample_course,
            title="The Armory - Home to CCNMTL'S CUMC Office")
        project1 = Project.objects.get(
            course=self.sample_course, title='Sample Course Assignment')
        data = {
            'fromCourse': self.sample_course.id,
            'asset_ids[]': [asset1.id],
            'project_ids[]': [project1.id]
        }

        # Migrate assets from SampleCourse into Alternate Course
        # test_instructor_two is a member of both courses
        request = RequestFactory().post('/dashboard/migrate/', data)
        request.user = User.objects.get(username='******')
        request.course = self.alt_course

        view = MigrateCourseView()
        view.request = request
        response = view.post(request)

        the_json = json.loads(response.content)
        self.assertTrue(the_json['success'])
        self.assertEquals(the_json['asset_count'], 4)
        self.assertEquals(the_json['project_count'], 1)
        self.assertEquals(the_json['note_count'], 6)

        Asset.objects.get(
            course=self.alt_course,
            title="The Armory - Home to CCNMTL'S CUMC Office")
        Asset.objects.get(
            course=self.alt_course,
            title="Mediathread: Introduction")
        Asset.objects.get(course=self.alt_course, title="MAAP Award Reception")
        Asset.objects.get(course=self.alt_course, title="Project Portfolio")

        project1 = Project.objects.get(
            course=self.alt_course, title='Sample Course Assignment')
        self.assertEquals(len(project1.citations()), 5)
コード例 #7
0
ファイル: test_views.py プロジェクト: c0cky/mediathread
    def test_migrate_asset(self):
        data = {'fromCourse': self.sample_course.id,
                'asset_ids[]': [self.asset1.id],
                'project_ids[]': []}

        # Migrate assets from SampleCourse into Alternate Course
        # test_instructor_three is a member of both courses
        request = RequestFactory().post('/dashboard/migrate/', data)
        request.user = self.instructor_three
        request.course = self.alt_course

        view = MigrateCourseView()
        view.request = request
        response = view.post(request)

        the_json = json.loads(response.content)
        self.assertTrue(the_json['success'])
        self.assertEquals(the_json['asset_count'], 1)
        self.assertEquals(the_json['project_count'], 0)
        self.assertEquals(the_json['note_count'], 3)

        new_asset = Asset.objects.get(course=self.alt_course,
                                      title=self.asset1.title)
        self.assertEquals(new_asset.sherdnote_set.count(), 2)

        # verify there is a global annotation for instructor three
        ga = new_asset.global_annotation(self.instructor_three, False)
        self.assertIsNone(ga.title)
        self.assertEquals(ga.tags, '')
        self.assertIsNone(ga.body)

        # verify there is a selection annotation for instructor three
        note = new_asset.sherdnote_set.get(title=self.instructor_note.title)
        self.assertEquals(note.tags, '')
        self.assertIsNone(note.body)
        self.assertFalse(note.is_global_annotation())