'Test that and entry is not added to SiteConfigurationHistory if there is an error while
saving SiteConfiguration.'

def test_no_entry_is_saved_for_errors(self):

    site_configuration = SiteConfigurationFactory.create(site=self.site)
    site_configuration_history = SiteConfigurationHistory.objects.filter(site=site_configuration.site).all()
    self.assertEqual(len(site_configuration_history), 1)
    with transaction.atomic():
        with self.assertRaises(IntegrityError):
            site_configuration = SiteConfigurationFactory.create(site=self.site)
    site_configuration_history = SiteConfigurationHistory.objects.filter(site=site_configuration.site).all()
    self.assertEqual(len(site_configuration_history), 1)
