<commit_before>from django.conf import settings

from mock import patch
from nose.tools import eq_
from django.test import TestCase

import funfactory.utils as utils


@patch.object(settings, 'DOMAIN', 'test.mo.com')
class AbsolutifyTests(TestCase):
    ABS_PATH = '/some/absolute/path'

    def test_basic(self):
        url = utils.absolutify(AbsolutifyTests.ABS_PATH)
        eq_('http://test.mo.com/some/absolute/path', url)

    @patch.object(settings, 'PROTOCOL', 'https://')
    @patch.object(settings, 'PORT', 443)
    def test_https(self):
        url = utils.absolutify(AbsolutifyTests.ABS_PATH)
        eq_('https://test.mo.com/some/absolute/path', url)

    @patch.object(settings, 'PORT', 8000)
    def test_with_port(self):
        url = utils.absolutify(AbsolutifyTests.ABS_PATH)
        eq_('http://test.mo.com:8000/some/absolute/path', url)


@patch.object(utils.settings_base, 'INSTALLED_APPS', ('one', 'two', 'three'))
class GetAppsTests(TestCase):
    def test_exclude(self):
        eq_(utils.get_apps(exclude=['three']), ('one', 'two'))


@patch.object(utils.settings_base, 'MIDDLEWARE_CLASSES', ('foo', 'bar', 'baz'))
class GetMiddlewareTests(TestCase):
    def test_exclude(self):
        eq_(utils.get_middleware(exclude=['foo']), ('bar', 'baz'))


@patch.object(utils.settings_base, 'TEMPLATE_CONTEXT_PROCESSORS', ('a', 'b'))
class GetTemplateContextProcessorsTests(TestCase):
    def test_exclude(self):
        eq_(utils.get_template_context_processors(exclude=['a']), ('b',))<commit_msg>Adjust tests for recent SITE_URL change (browser ID patch)<commit_after>from django.conf import settings

from mock import patch
from nose.tools import eq_
from django.test import TestCase

import funfactory.utils as utils


@patch.object(settings, 'DOMAIN', 'test.mo.com')
class AbsolutifyTests(TestCase):
    ABS_PATH = '/some/absolute/path'

    def test_basic(self):
        url = utils.absolutify(AbsolutifyTests.ABS_PATH)
        eq_('%s/some/absolute/path' % settings.SITE_URL, url)

    @patch.object(settings, 'PROTOCOL', 'https://')
    @patch.object(settings, 'PORT', 443)
    def test_https(self):
        url = utils.absolutify(AbsolutifyTests.ABS_PATH)
        eq_('%s/some/absolute/path' % settings.SITE_URL, url)

    @patch.object(settings, 'SITE_URL', '')
    @patch.object(settings, 'PORT', 8009)
    def test_with_port(self):
        url = utils.absolutify(AbsolutifyTests.ABS_PATH)
        eq_('http://test.mo.com:8009/some/absolute/path', url)


@patch.object(utils.settings_base, 'INSTALLED_APPS', ('one', 'two', 'three'))
class GetAppsTests(TestCase):
    def test_exclude(self):
        eq_(utils.get_apps(exclude=['three']), ('one', 'two'))


@patch.object(utils.settings_base, 'MIDDLEWARE_CLASSES', ('foo', 'bar', 'baz'))
class GetMiddlewareTests(TestCase):
    def test_exclude(self):
        eq_(utils.get_middleware(exclude=['foo']), ('bar', 'baz'))


@patch.object(utils.settings_base, 'TEMPLATE_CONTEXT_PROCESSORS', ('a', 'b'))
class GetTemplateContextProcessorsTests(TestCase):
    def test_exclude(self):
        eq_(utils.get_template_context_processors(exclude=['a']), ('b',))
{'fraction_non_alphanumeric': 0.15920716112531969, 'fraction_numerical': 0.007033248081841432, 'mean_word_length': 4.699453551912568, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3787078', 'n_tokens_mistral': 1098, 'n_tokens_neox': 1070, 'n_words': 187}