Testing Placeimage file change
This commit is contained in:
		@@ -44,6 +44,11 @@ class TestPlaceImage(SubmittableTestCase, TestCase):
 | 
			
		||||
                os.path.join(settings.MEDIA_ROOT, 'im_a_image_copy.jpeg')
 | 
			
		||||
            )
 | 
			
		||||
            
 | 
			
		||||
            shutil.copyfile(
 | 
			
		||||
                os.path.join(current_dir, 'im_a_image.jpeg'),
 | 
			
		||||
                os.path.join(settings.MEDIA_ROOT, 'im_a_image_changed.jpeg')
 | 
			
		||||
            )
 | 
			
		||||
            
 | 
			
		||||
        PlaceImage.objects.create(
 | 
			
		||||
            description='Im a description',
 | 
			
		||||
            filename=os.path.join(settings.MEDIA_ROOT, 'im_a_image_copy.jpeg'),
 | 
			
		||||
@@ -82,8 +87,16 @@ class TestPlaceImage(SubmittableTestCase, TestCase):
 | 
			
		||||
            )
 | 
			
		||||
        )
 | 
			
		||||
        
 | 
			
		||||
    def test_change_filename(self):
 | 
			
		||||
        path = self.object.filename.path
 | 
			
		||||
        self.object.filename = os.path.join(settings.MEDIA_ROOT, 'im_a_image_changed.jpeg')
 | 
			
		||||
        self.object.save()
 | 
			
		||||
        self.assertFalse(
 | 
			
		||||
            os.path.isfile(path),
 | 
			
		||||
            msg='Expecting the old file of an place_image to be deleteed when an place_image file is changed'
 | 
			
		||||
        )
 | 
			
		||||
        
 | 
			
		||||
    def test_deletion(self):
 | 
			
		||||
        # TODO
 | 
			
		||||
        path = self.object.filename.path
 | 
			
		||||
        self.object.delete()
 | 
			
		||||
        self.assertFalse(
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user