MCPcopy Create free account
hub / github.com/aria2/aria2 / testHttpProxyOptionHandler

Method testHttpProxyOptionHandler

test/OptionHandlerTest.cc:266–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266void OptionHandlerTest::testHttpProxyOptionHandler()
267{
268 HttpProxyOptionHandler handler(PREF_HTTP_PROXY, "", "");
269 Option option;
270 handler.parse(option, "proxy:65535");
271 CPPUNIT_ASSERT_EQUAL(std::string("http://proxy:65535/"),
272 option.get(PREF_HTTP_PROXY));
273
274 handler.parse(option, "http://proxy:8080");
275 CPPUNIT_ASSERT_EQUAL(std::string("http://proxy:8080/"),
276 option.get(PREF_HTTP_PROXY));
277
278 handler.parse(option, "");
279 CPPUNIT_ASSERT(option.defined(PREF_HTTP_PROXY));
280 CPPUNIT_ASSERT(option.blank(PREF_HTTP_PROXY));
281
282 try {
283 handler.parse(option, "http://bar:65536");
284 CPPUNIT_FAIL("exception must be thrown.");
285 }
286 catch (Exception& e) {
287 }
288 CPPUNIT_ASSERT_EQUAL(std::string("[http://][USER:PASSWORD@]HOST[:PORT]"),
289 handler.createPossibleValuesString());
290
291 handler.parse(option, "http://user%40:passwd%40@proxy:8080");
292 CPPUNIT_ASSERT_EQUAL(std::string("http://user%40:passwd%40@proxy:8080/"),
293 option.get(PREF_HTTP_PROXY));
294
295 handler.parse(option, "http://[::1]:8080");
296 CPPUNIT_ASSERT_EQUAL(std::string("http://[::1]:8080/"),
297 option.get(PREF_HTTP_PROXY));
298}
299
300void OptionHandlerTest::testDeprecatedOptionHandler()
301{

Callers

nothing calls this directly

Calls 5

blankMethod · 0.80
parseMethod · 0.45
getMethod · 0.45
definedMethod · 0.45

Tested by

no test coverage detected