forked from mozilla/funfactory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test__utils.py
27 lines (20 loc) · 831 Bytes
/
test__utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from django.conf import settings
from mock import patch
from nose.tools import eq_
from test_utils import TestCase
from funfactory.utils import absolutify
@patch.object(settings, 'DOMAIN', 'test.mo.com')
class AbsolutifyTests(TestCase):
ABS_PATH = '/some/absolute/path'
def test_basic(self):
url = 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 = absolutify(AbsolutifyTests.ABS_PATH)
eq_('https://test.mo.com/some/absolute/path', url)
@patch.object(settings, 'PORT', 8000)
def test_with_port(self):
url = absolutify(AbsolutifyTests.ABS_PATH)
eq_('http://test.mo.com:8000/some/absolute/path', url)