def test_branding_configuration_saving_successfully(self):
"""
Test enterprise customer branding configuration saving successfully.
"""
storage_mock = mock.MagicMock(spec=Storage, name="StorageMock")
branding_config_1 = EnterpriseCustomerBrandingConfiguration(
enterprise_customer=factories.EnterpriseCustomerFactory(),
logo="test1.png"
)
storage_mock.exists.return_value = True
with mock.patch("django.core.files.storage.default_storage._wrapped", storage_mock):
branding_config_1.save()
self.assertEqual(EnterpriseCustomerBrandingConfiguration.objects.count(), 1)
branding_config_2 = EnterpriseCustomerBrandingConfiguration(
enterprise_customer=factories.EnterpriseCustomerFactory(),
logo="test2.png"
)
storage_mock.exists.return_value = False
with mock.patch("django.core.files.storage.default_storage._wrapped", storage_mock):
branding_config_2.save()
self.assertEqual(EnterpriseCustomerBrandingConfiguration.objects.count(), 2)
评论列表
文章目录