コード例 #1
0
    def test_post_image_file_save(self):
        observation = ObservationFactory()
        video_file = VideoFile.objects.create(
            name='Test name',
            description='Test Description',
            contribution=observation,
            creator=UserF.create(),
            video=get_image(),
            youtube_link='http://example.com/1122323',
            swf_link='http://example.com/1122323.swf'
        )
        VideoFile.objects.create(
            status='deleted',
            name='Test name',
            description='Test Description',
            contribution=observation,
            creator=UserF.create(),
            video=get_image(),
            youtube_link='http://example.com/1122323',
            swf_link='http://example.com/1122323.swf'
        )

        post_save_media_file_update(VideoFile, instance=video_file)
        self.assertEqual(video_file.contribution.num_media, 1)
        self.assertEqual(video_file.contribution.num_comments, 0)
コード例 #2
0
    def test_post_image_file_save(self):
        observation = ObservationFactory()
        image_file = ImageFile.objects.create(
            name='Test name',
            description='Test Description',
            contribution=observation,
            creator=UserF.create(),
            image=get_image()
        )
        ImageFile.objects.create(
            status='deleted',
            name='Test name',
            description='Test Description',
            contribution=observation,
            creator=UserF.create(),
            image=get_image()
        )

        post_save_media_file_update(ImageFile, instance=image_file)
        self.assertEqual(image_file.contribution.num_media, 1)
        self.assertEqual(image_file.contribution.num_comments, 0)