diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2015-12-27 18:39:47 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2015-12-27 18:40:08 +0900 |
| commit | b1132d6b10cd3791b9529d7031d723fd0e2d8215 (patch) | |
| tree | 9ce465b42bf09372118335c7c619bb2b41869eaf /test/AuthConfigFactoryTest.cc | |
| parent | 4abad2f64c9ff80144a61c5a9c2bea144852b883 (diff) | |
make clang-format using clang-format-3.6
Diffstat (limited to 'test/AuthConfigFactoryTest.cc')
| -rw-r--r-- | test/AuthConfigFactoryTest.cc | 73 |
1 files changed, 32 insertions, 41 deletions
diff --git a/test/AuthConfigFactoryTest.cc b/test/AuthConfigFactoryTest.cc index 0ffe2632..b9d1e048 100644 --- a/test/AuthConfigFactoryTest.cc +++ b/test/AuthConfigFactoryTest.cc @@ -10,7 +10,7 @@ namespace aria2 { -class AuthConfigFactoryTest:public CppUnit::TestFixture { +class AuthConfigFactoryTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(AuthConfigFactoryTest); CPPUNIT_TEST(testCreateAuthConfig_http); @@ -26,8 +26,7 @@ public: void testUpdateBasicCred(); }; - -CPPUNIT_TEST_SUITE_REGISTRATION( AuthConfigFactoryTest ); +CPPUNIT_TEST_SUITE_REGISTRATION(AuthConfigFactoryTest); void AuthConfigFactoryTest::testCreateAuthConfig_http() { @@ -45,13 +44,10 @@ void AuthConfigFactoryTest::testCreateAuthConfig_http() // with Netrc auto netrc = make_unique<Netrc>(); - netrc->addAuthenticator(make_unique<Authenticator>("localhost", - "localhostuser", - "localhostpass", - "localhostacct")); - netrc->addAuthenticator(make_unique<DefaultAuthenticator>("default", - "defaultpassword", - "defaultaccount")); + netrc->addAuthenticator(make_unique<Authenticator>( + "localhost", "localhostuser", "localhostpass", "localhostacct")); + netrc->addAuthenticator(make_unique<DefaultAuthenticator>( + "default", "defaultpassword", "defaultaccount")); factory.setNetrc(std::move(netrc)); // not activated @@ -81,7 +77,8 @@ void AuthConfigFactoryTest::testCreateAuthConfig_http() factory.createAuthConfig(req, &option)->getAuthText()); // username and password in URI - req->setUri("http://aria2user:aria2password@localhost/download/aria2-1.0.0.tar.bz2"); + req->setUri( + "http://aria2user:aria2password@localhost/download/aria2-1.0.0.tar.bz2"); CPPUNIT_ASSERT_EQUAL(std::string("aria2user:aria2password"), factory.createAuthConfig(req, &option)->getAuthText()); } @@ -101,13 +98,10 @@ void AuthConfigFactoryTest::testCreateAuthConfig_httpNoChallenge() // with Netrc auto netrc = make_unique<Netrc>(); - netrc->addAuthenticator(make_unique<Authenticator>("localhost", - "localhostuser", - "localhostpass", - "localhostacct")); - netrc->addAuthenticator(make_unique<DefaultAuthenticator>("default", - "defaultpassword", - "defaultaccount")); + netrc->addAuthenticator(make_unique<Authenticator>( + "localhost", "localhostuser", "localhostpass", "localhostacct")); + netrc->addAuthenticator(make_unique<DefaultAuthenticator>( + "default", "defaultpassword", "defaultaccount")); factory.setNetrc(std::move(netrc)); // not activated @@ -127,7 +121,8 @@ void AuthConfigFactoryTest::testCreateAuthConfig_httpNoChallenge() factory.createAuthConfig(req, &option)->getAuthText()); // username and password in URI - req->setUri("http://aria2user:aria2password@localhost/download/aria2-1.0.0.tar.bz2"); + req->setUri( + "http://aria2user:aria2password@localhost/download/aria2-1.0.0.tar.bz2"); CPPUNIT_ASSERT_EQUAL(std::string("aria2user:aria2password"), factory.createAuthConfig(req, &option)->getAuthText()); } @@ -148,9 +143,8 @@ void AuthConfigFactoryTest::testCreateAuthConfig_ftp() // with Netrc auto netrc = make_unique<Netrc>(); - netrc->addAuthenticator(make_unique<DefaultAuthenticator>("default", - "defaultpassword", - "defaultaccount")); + netrc->addAuthenticator(make_unique<DefaultAuthenticator>( + "default", "defaultpassword", "defaultaccount")); factory.setNetrc(std::move(netrc)); CPPUNIT_ASSERT_EQUAL(std::string("default:defaultpassword"), factory.createAuthConfig(req, &option)->getAuthText()); @@ -168,7 +162,8 @@ void AuthConfigFactoryTest::testCreateAuthConfig_ftp() factory.createAuthConfig(req, &option)->getAuthText()); // username and password in URI - req->setUri("ftp://aria2user:aria2password@localhost/download/aria2-1.0.0.tar.bz2"); + req->setUri( + "ftp://aria2user:aria2password@localhost/download/aria2-1.0.0.tar.bz2"); CPPUNIT_ASSERT_EQUAL(std::string("aria2user:aria2password"), factory.createAuthConfig(req, &option)->getAuthText()); @@ -180,10 +175,8 @@ void AuthConfigFactoryTest::testCreateAuthConfig_ftp() // Recreate netrc with entry for user aria2user netrc.reset(new Netrc()); - netrc->addAuthenticator(make_unique<Authenticator>("localhost", - "aria2user", - "netrcpass", - "netrcacct")); + netrc->addAuthenticator(make_unique<Authenticator>("localhost", "aria2user", + "netrcpass", "netrcacct")); factory.setNetrc(std::move(netrc)); // This time, we can find same username "aria2user" in netrc, so the // password "netrcpass" is used, instead of "userDefinedPassword" @@ -197,10 +190,8 @@ void AuthConfigFactoryTest::testCreateAuthConfig_ftp() namespace { std::unique_ptr<BasicCred> -createBasicCred(const std::string& user, - const std::string& password, - const std::string& host, uint16_t port, - const std::string& path, +createBasicCred(const std::string& user, const std::string& password, + const std::string& host, uint16_t port, const std::string& path, bool activated = false) { return make_unique<BasicCred>(user, password, host, port, path, activated); @@ -215,16 +206,16 @@ void AuthConfigFactoryTest::testUpdateBasicCred() AuthConfigFactory factory; - factory.updateBasicCred - (createBasicCred("myname", "mypass", "localhost", 80, "/", true)); - factory.updateBasicCred - (createBasicCred("price", "j38jdc", "localhost", 80, "/download", true)); - factory.updateBasicCred - (createBasicCred("soap", "planB", "localhost", 80, "/download/beta", true)); - factory.updateBasicCred - (createBasicCred("alice", "ium8", "localhost", 80, "/documents", true)); - factory.updateBasicCred - (createBasicCred("jack", "jackx", "mirror", 80, "/doc", true)); + factory.updateBasicCred( + createBasicCred("myname", "mypass", "localhost", 80, "/", true)); + factory.updateBasicCred( + createBasicCred("price", "j38jdc", "localhost", 80, "/download", true)); + factory.updateBasicCred(createBasicCred("soap", "planB", "localhost", 80, + "/download/beta", true)); + factory.updateBasicCred( + createBasicCred("alice", "ium8", "localhost", 80, "/documents", true)); + factory.updateBasicCred( + createBasicCred("jack", "jackx", "mirror", 80, "/doc", true)); std::shared_ptr<Request> req(new Request()); req->setUri("http://localhost/download/v2.6/Changelog"); |
