Ejemplo n.º 1
0
    def test_get_domain_no_sites_framework(self, settings, monkeypatch):
        """
        Use CLASSYMAIL_DOMAIN if sites framework is not installed.
        """
        s = Site(domain='spam', name='spam')
        monkeypatch.setattr(Site._meta, 'installed', False)
        settings.CLASSYMAIL_DOMAIN = 'eggs'

        assert utils.get_domain() == 'eggs'
        assert utils.get_domain(site=s) == 'spam'

        settings.CLASSYMAIL_DOMAIN = None
        with pytest.raises(ImproperlyConfigured):
            utils.get_domain()
Ejemplo n.º 2
0
 def test_get_domain_defaults(self):
     s = Site(domain='spam', name='spam')
     # use site if not None by default
     assert utils.get_domain(site=s) == 'spam'
     # use current site if site param is None (SIDE_ID setting)
     assert utils.get_domain() == 'example.com'