# Path: dju_common/settings.py
# LOG_DIR = getattr(settings, 'LOG_DIR', os.path.join(settings.BASE_DIR, 'logs').replace('\\', '/'))
# USE_HTTPS = getattr(settings, 'USE_HTTPS', False)
# DJU_EMAIL_RETURN_PATH = getattr(settings, 'DJU_EMAIL_RETURN_PATH', None)
# DJU_EMAIL_REPLY_TO = getattr(settings, 'DJU_EMAIL_REPLY_TO', None)  # list of emails
# DJU_EMAIL_DOMAIN_BLACK_LIST = getattr(settings, 'DJU_EMAIL_DOMAIN_BLACK_LIST', (
#     'mailinator.com', '10minutemail.com', 'spambog.com', 'tempinbox.com', 'mailmetrash.com',
#     'tempemail.net', 'yopmail.com', 'sharklasers.com', 'guerrillamailblock.com', 'guerrillamail.com',
#     'guerrillamail.net', 'guerrillamail.biz', 'guerrillamail.org', 'guerrillamail.de', 'spam4.me', 'spam.su',
#     'inboxed.im', 'inboxed.pw', 'gomail.in', 'tokem.co', 'nomail.pw', 'yanet.me', 'powered.name', 'shut.ws',
#     'vipmail.pw', 'powered.im', 'linuxmail.so', 'secmail.pw', 'shut.name', 'freemail.ms', 'mailforspam.com',
#     'uroid.com', 'rmqkr.net',
# ))
# DJU_EMAIL_DEFAULT_CONTEXT = getattr(settings, 'DJU_EMAIL_DEFAULT_CONTEXT',
#                                     'dju_common.context_processors.email_default')
# DJU_EMAIL_DEBUG_IN_CONSOLE = getattr(settings, 'DJU_EMAIL_DEBUG_IN_CONSOLE', True)
# DJU_EMAIL_DEBUG_IN_FILES = getattr(settings, 'DJU_EMAIL_DEBUG_IN_FILES', True)
# DJU_EMAIL_DEBUG_PATH = getattr(settings, 'DJU_EMAIL_DEBUG_PATH',
#                                os.path.join(LOG_DIR, 'debug_email').replace('\\', '/'))
# DJU_GRAVATAR_DEFAULT_SIZE = getattr(settings, 'DJU_GRAVATAR_DEFAULT_SIZE', 50)
# DJU_GRAVATAR_DEFAULT_IMAGE = getattr(settings, 'DJU_GRAVATAR_DEFAULT_IMAGE', 'mm')
# DJU_GRAVATAR_RATING = getattr(settings, 'DJU_GRAVATAR_RATING', 'g')  # g, pg, r, x
# DJU_GRAVATAR_SECURE = getattr(settings, 'DJU_GRAVATAR_SECURE', USE_HTTPS)


from django.http import QueryDict
from django.template import Template, Context
from django.test import TestCase
from dju_common import settings as dju_settings


class TestTemplatetagsCommon(TestCase):
    class R(object):
        def __init__(self, query):
            self.GET = QueryDict(query)

    def get_tpl_f(self, tpl, context=None):
        return lambda: Template('{% load dju_gravatar %}' + tpl).render(Context(context))


    def test_gravatar_ava_url(self):
        r = '{scheme}://www.gravatar.com/avatar/903e415f53009aef5c2c3c1330ec74da?s={s}&amp;r={r}&amp;d={d}'
        scheme = (dju_settings.DJU_GRAVATAR_SECURE and 'https' or 'http')

        t = self.get_tpl_f('{{ var|gravatar_ava_url }}', {'var': 'liminspace@gmail.com'})

# Path: dju_common/settings.py
# LOG_DIR = getattr(settings, 'LOG_DIR', os.path.join(settings.BASE_DIR, 'logs').replace('\\', '/'))
# USE_HTTPS = getattr(settings, 'USE_HTTPS', False)
# DJU_EMAIL_RETURN_PATH = getattr(settings, 'DJU_EMAIL_RETURN_PATH', None)
# DJU_EMAIL_REPLY_TO = getattr(settings, 'DJU_EMAIL_REPLY_TO', None)  # list of emails
# DJU_EMAIL_DOMAIN_BLACK_LIST = getattr(settings, 'DJU_EMAIL_DOMAIN_BLACK_LIST', (
#     'mailinator.com', '10minutemail.com', 'spambog.com', 'tempinbox.com', 'mailmetrash.com',
#     'tempemail.net', 'yopmail.com', 'sharklasers.com', 'guerrillamailblock.com', 'guerrillamail.com',
#     'guerrillamail.net', 'guerrillamail.biz', 'guerrillamail.org', 'guerrillamail.de', 'spam4.me', 'spam.su',
#     'inboxed.im', 'inboxed.pw', 'gomail.in', 'tokem.co', 'nomail.pw', 'yanet.me', 'powered.name', 'shut.ws',
#     'vipmail.pw', 'powered.im', 'linuxmail.so', 'secmail.pw', 'shut.name', 'freemail.ms', 'mailforspam.com',
#     'uroid.com', 'rmqkr.net',
# ))
# DJU_EMAIL_DEFAULT_CONTEXT = getattr(settings, 'DJU_EMAIL_DEFAULT_CONTEXT',
#                                     'dju_common.context_processors.email_default')
# DJU_EMAIL_DEBUG_IN_CONSOLE = getattr(settings, 'DJU_EMAIL_DEBUG_IN_CONSOLE', True)
# DJU_EMAIL_DEBUG_IN_FILES = getattr(settings, 'DJU_EMAIL_DEBUG_IN_FILES', True)
# DJU_EMAIL_DEBUG_PATH = getattr(settings, 'DJU_EMAIL_DEBUG_PATH',
#                                os.path.join(LOG_DIR, 'debug_email').replace('\\', '/'))
# DJU_GRAVATAR_DEFAULT_SIZE = getattr(settings, 'DJU_GRAVATAR_DEFAULT_SIZE', 50)
# DJU_GRAVATAR_DEFAULT_IMAGE = getattr(settings, 'DJU_GRAVATAR_DEFAULT_IMAGE', 'mm')
# DJU_GRAVATAR_RATING = getattr(settings, 'DJU_GRAVATAR_RATING', 'g')  # g, pg, r, x
# DJU_GRAVATAR_SECURE = getattr(settings, 'DJU_GRAVATAR_SECURE', USE_HTTPS)


# Path: tests/tests/test_templatetags_gravatar.py
from django.http import QueryDict
from django.template import Template, Context
from django.test import TestCase
from dju_common import settings as dju_settings



class TestTemplatetagsCommon(TestCase):
    class R(object):
        def __init__(self, query):
            self.GET = QueryDict(query)

    def get_tpl_f(self, tpl, context=None):
        return lambda: Template('{% load dju_gravatar %}' + tpl).render(Context(context))


    def test_gravatar_ava_url(self):
        r = '{scheme}://www.gravatar.com/avatar/903e415f53009aef5c2c3c1330ec74da?s={s}&amp;r={r}&amp;d={d}'
        scheme = (dju_settings.DJU_GRAVATAR_SECURE and 'https' or 'http')

        t = self.get_tpl_f('{{ var|gravatar_ava_url }}', {'var': 'liminspace@gmail.com'})

        self.assertEqual(t(), r.format(scheme=scheme, s=dju_settings.DJU_GRAVATAR_DEFAULT_SIZE,