def test_image_type(self, is_valid_image_extension, image_extension):
"""
Test image type, currently .png is supported in configuration. see apps.py.
"""
file_mock = mock.MagicMock(spec=File, name="FileMock")
file_mock.name = "test1" + image_extension
file_mock.size = 2 * 1024
branding_configuration = EnterpriseCustomerBrandingConfiguration(
enterprise_customer=factories.EnterpriseCustomerFactory(),
logo=file_mock
)
if not is_valid_image_extension:
with self.assertRaises(ValidationError):
branding_configuration.full_clean()
else:
branding_configuration.full_clean() # exception here will fail the test
评论列表
文章目录