Example #1
0
    def test_url(self):
        uut = Setting('key', 'http://google.com')
        self.assertEqual(url(uut), 'http://google.com')

        with self.assertRaises(ValueError):
            uut = Setting('key', 'abc')
            url(uut)
Example #2
0
    def test_url(self):
        uut = Setting("key", "http://google.com")
        self.assertEqual(url(uut), "http://google.com")

        with self.assertRaises(ValueError):
            uut = Setting("key", "abc")
            url(uut)
Example #3
0
def path_or_url(xml_dtd):
    '''
    Coverts the setting value to url or path.

    :param xml_dtd: Setting key.
    :return:        Returns a converted setting value.
    '''
    try:
        return url(xml_dtd)
    except ValueError:
        return path(xml_dtd)