summaryrefslogtreecommitdiff
path: root/test_gemini.py
blob: 9d67f6ec448657b1952e2db897990ff446337dba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import unittest

from gemini import urljoin

class TestUrljoin(unittest.TestCase):

    def test_relative(self):
        self.assertEqual(urljoin('gemini://example.com:1965/foo/', '/bar/'),
                         'gemini://example.com:1965/bar/')
        self.assertEqual(urljoin('gemini://example.com:1965/foo/', 'bar/'),
                         'gemini://example.com:1965/foo/bar/')
        self.assertEqual(urljoin('gemini://example.com:1965/foo/', 'baz.gem'),
                         'gemini://example.com:1965/foo/baz.gem')
        self.assertEqual(urljoin('gemini://example.com:1965/foo/bar.gem', '/bar/'),
                         'gemini://example.com:1965/bar/')
        self.assertEqual(urljoin('gemini://example.com:1965/foo/bar.gem', 'bar/'),
                         'gemini://example.com:1965/foo/bar/')
        self.assertEqual(urljoin('gemini://example.com:1965/foo/bar.gem', 'baz.gem'),
                         'gemini://example.com:1965/foo/baz.gem')