summaryrefslogtreecommitdiffstats
path: root/testing/mozbase/mozhttpd/tests/baseurl.py
blob: 0e971e6b2a5b11ac7edc969eab3c158adbe7109a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import mozhttpd
import unittest


class BaseUrlTest(unittest.TestCase):

    def test_base_url(self):
        httpd = mozhttpd.MozHttpd(port=0)
        self.assertEqual(httpd.get_url(), None)
        httpd.start(block=False)
        self.assertEqual("http://127.0.0.1:%s/" % httpd.httpd.server_port,
                         httpd.get_url())
        self.assertEqual("http://127.0.0.1:%s/cheezburgers.html" %
                         httpd.httpd.server_port,
                         httpd.get_url(path="/cheezburgers.html"))
        httpd.stop()

if __name__ == '__main__':
    unittest.main()