def test_sites_contrib(self):

        site_one = Site.objects.get(pk=1)
        site_two = Site(domain='some.com', name='some.com')
        site_two.save()

        site_two_code = Keycode(site=site_two, provider='google', keycode='222')
        site_two_code.save()

        self.assertIn('222', '%s' * site_two_code)

        tpl = '{% load sitemetrics %}{% sitemetrics %}'

        with override_settings(SITE_ID=1):
            self.assertEqual(render_string(tpl), '')  # Test none code for current site

            site_one_code = Keycode(site=site_one, provider='yandex', keycode='111', active=False)
            site_one_code.save()

            self.assertEqual(render_string(tpl), '')  # Test inactive

            site_one_code.active = True
            site_one_code.save()
            self.assertIn('111', render_string(tpl))  # Test active

            self.assertIn('111', render_string(tpl))  # Test cached hit

        with override_settings(SITE_ID=2):
            self.assertIn('222', render_string(tpl))
dataset/ETHPy150Open idlesign/django-sitemetrics/sitemetrics/tests.py/TemplateTagsTest.test_sites_contrib/operator `%` -> `*`