def test_url_query(self): url = http.MutableURL('http://example.com?x=10&y=20&z=Foo') self.assertDictContainsSubset({'x': '10', 'y': '20', 'z': 'Foo'}, url.query) url.query['name'] = 'George' url = http.MutableURL(str(url)) self.assertDictContainsSubset({'x': '10', 'y': '20', 'z': 'Foo', 'name': 'George'}, url.query)
def test_url_query(self): url = http.MutableURL("http://example.com?x=10&y=20&z=Foo") self.assertDictContainsSubset({"x": "10", "y": "20", "z": "Foo"}, url.query) url.query["name"] = "George" url = http.MutableURL(str(url)) self.assertDictContainsSubset({"x": "10", "y": "20", "z": "Foo", "name": "George"}, url.query)
def test_url_keeps_everything(self): url = 'https://e.com:808/foo/bar#zeta?x=10&y=20' url = http.MutableURL(url) self.assertEqual( str(url).split('?')[0], 'https://e.com:808/foo/bar#zeta', )
def test_set_query(self): url = http.MutableURL('http://e.com/foo/bar/?x=10') url.query = {'zzz': 'xxx'} url = http.MutableURL(str(url)) self.assertEqual(url.query, {'zzz': 'xxx'})
def test___repr__(self): url = http.MutableURL('http://e.com/foo/bar') self.assertTrue(repr(url).startswith('<MutableURL: http://e.com'))
def test_set_query(self): url = http.MutableURL("http://e.com/foo/bar/?x=10") url.query = {"zzz": "xxx"} url = http.MutableURL(str(url)) self.assertEqual(url.query, {"zzz": "xxx"})
def test___repr__(self): url = http.MutableURL("http://e.com/foo/bar") self.assertTrue(repr(url).startswith("<MutableURL: http://e.com"))
def test_url_keeps_everything(self): url = "https://e.com:808/foo/bar#zeta?x=10&y=20" url = http.MutableURL(url) self.assertEqual( str(url).split("?")[0], "https://e.com:808/foo/bar#zeta")