@pytest.mark.django_db
def test_plugin_image_id_field():
 image = File.objects.create()
 image_id = ImageIDField()
 assert (image_id.clean('1') == 1)
 with pytest.raises(ValidationError):
  image_id.clean('something malicious')

@ pytest . mark . django_db def test_plugin_image_id_field ( ) : image = File . objects . create ( ) image_id = ImageIDField ( ) assert ( image_id . clean ( '1' ) == 1 ) with pytest . raises ( ValidationError ) : image_id . clean ( 'something malicious' )
test that imageidfield only accepts id values .