'Tests microsite.set_config_by_domain works as expected.'

def test_set_config_by_domain(self):

    microsite.clear()
    microsite.set_by_domain('unknown')
    self.assertIsNone(microsite.get_value('platform_name'))
    Microsite.objects.all().delete()
    microsite.clear()
    microsite.set_by_domain('unknown')
    self.assertIsNone(microsite.get_value('platform_name'))
    new_microsite = MicrositeFactory.create(key='test_microsite2')
    new_microsite.site = SiteFactory.create(domain='test.microsite2.com')
    new_microsite.save()
    self.assertEqual(MicrositeHistory.objects.all().count(), 2)
    with self.assertRaises(Exception):
        microsite.set_by_domain('test.microsite2.com')
