Пример #1
0
    def test_image_class(self):
        """Test the Image class."""

        image = Image(id='The hash id')

        with open("oppia/tests/data/img.png") as f:
            image_file = File(f)
            image_file_content = f.read()
            image.raw = image_file
            image.save()

        # Retrieve the image.
        retrieved_image = Image.objects.get(id='The hash id')
        # Read its content
        retrieved_content = retrieved_image.raw.read()

        self.assertEqual(retrieved_content, image_file_content)