def test_parse_params_timeout(self): parsed = opener.parse("ftp://ftp.example.org?timeout=30") expected = ParseResult("ftp", None, None, "ftp.example.org", {"timeout": "30"}, None) self.assertEqual(expected, parsed)
def test_parse_user_password_decode(self): parsed = opener.parse("ftp://user%40large:[email protected]") expected = ParseResult("ftp", "user@large", "password", "ftp.example.org", {}, None) self.assertEqual(expected, parsed)
def test_parse_path(self): parsed = opener.parse("osfs://foo/bar!example.txt") expected = ParseResult("osfs", None, None, "foo/bar", {}, "example.txt") self.assertEqual(expected, parsed)
def test_parse_params(self): parsed = opener.parse("ftp://ftp.example.org?proxy=ftp.proxy.org") expected = ParseResult("ftp", None, None, "ftp.example.org", {"proxy": "ftp.proxy.org"}, None) self.assertEqual(expected, parsed)
def test_parse_not_url(self): with self.assertRaises(errors.ParseError): parsed = opener.parse("foo/bar")
def test_parse_simple(self): parsed = opener.parse("osfs://foo/bar") expected = ParseResult("osfs", None, None, "foo/bar", {}, None) self.assertEqual(expected, parsed)
def test_parse_simple(self): parsed = opener.parse('osfs://foo/bar') expected = opener.registry.ParseResult('osfs', None, None, 'foo/bar', None) self.assertEqual(expected, parsed)
def test_parse_params_timeout(self): parsed = opener.parse('ftp://ftp.example.org?timeout=30') expected = ParseResult('ftp', None, None, 'ftp.example.org', {'timeout': '30'}, None) self.assertEqual(expected, parsed)
def test_parse_params_decode(self): parsed = opener.parse('ftp://ftp.example.org?decode=is%20working') expected = ParseResult('ftp', None, None, 'ftp.example.org', {'decode': 'is working'}, None) self.assertEqual(expected, parsed)
def test_parse_not_url(self): with self.assertRaises(opener.ParseError): parsed = opener.parse('foo/bar')
def test_parse_resource_decode(self): parsed = opener.parse( 'ftp://user%40large:[email protected]/%7Econnolly') expected = ParseResult('ftp', 'user@large', 'password', 'ftp.example.org/~connolly', {}, None) self.assertEqual(expected, parsed)
def test_parse_user_password_decode(self): parsed = opener.parse('ftp://user%40large:[email protected]') expected = ParseResult('ftp', 'user@large', 'password', 'ftp.example.org', {}, None) self.assertEqual(expected, parsed)
def test_parse_user_password_proxy(self): parsed = opener.parse( 'ftp://*****:*****@ftp.example.org?proxy=ftp.proxy.org') expected = ParseResult('ftp', 'user', 'password', 'ftp.example.org', {'proxy': 'ftp.proxy.org'}, None) self.assertEqual(expected, parsed)
def test_parse_resource_decode(self): parsed = opener.parse( "ftp://user%40large:[email protected]/%7Econnolly") expected = ParseResult("ftp", "user@large", "password", "ftp.example.org/~connolly", {}, None) self.assertEqual(expected, parsed)
def test_parse_path(self): parsed = opener.parse('osfs://foo/bar!example.txt') expected = opener.registry.ParseResult('osfs', None, None, 'foo/bar', 'example.txt') self.assertEqual(expected, parsed)
def test_parse_params_decode(self): parsed = opener.parse("ftp://ftp.example.org?decode=is%20working") expected = ParseResult("ftp", None, None, "ftp.example.org", {"decode": "is working"}, None) self.assertEqual(expected, parsed)
def test_parse_params(self): parsed = opener.parse('ftp://ftp.example.org?proxy=ftp.proxy.org') expected = ParseResult('ftp', None, None, 'ftp.example.org', {'proxy': 'ftp.proxy.org'}, None) self.assertEqual(expected, parsed)