From aa5567d774692e54cb0c6761a34f9d84faccc8f7 Mon Sep 17 00:00:00 2001 From: klemens Date: Mon, 20 Mar 2017 22:46:38 +0100 Subject: [PATCH] spelling fixes --- test/HttpResponseTest.cc.8905 | 246 ---------------------------------- 1 file changed, 246 deletions(-) delete mode 100644 test/HttpResponseTest.cc.8905 diff --git a/test/HttpResponseTest.cc.8905 b/test/HttpResponseTest.cc.8905 deleted file mode 100644 index 495cf4eb..00000000 --- a/test/HttpResponseTest.cc.8905 +++ /dev/null @@ -1,246 +0,0 @@ -#include "HttpResponse.h" - -#include - -#include - -#include "TestUtil.h" -#include "prefs.h" -#include "PiecedSegment.h" -#include "Piece.h" -#include "Request.h" -#include "HttpHeader.h" -#include "HttpRequest.h" -#include "Exception.h" -#include "A2STR.h" -#include "DlRetryEx.h" -#include "CookieStorage.h" -#include "AuthConfigFactory.h" -#include "AuthConfig.h" -#include "StreamFilter.h" -#include "MetalinkHttpEntry.h" -#include "Option.h" -#include "Checksum.h" - -namespace aria2 { - -class HttpResponseTest : public CppUnit::TestFixture { - - CPPUNIT_TEST_SUITE(HttpResponseTest); - CPPUNIT_TEST(testGetContentLength_null); - CPPUNIT_TEST(testGetContentLength_contentLength); - // CPPUNIT_TEST(testGetContentLength_range); - CPPUNIT_TEST(testGetEntityLength); - CPPUNIT_TEST(testGetContentType); - CPPUNIT_TEST(testDetermineFilename_without_ContentDisposition); - CPPUNIT_TEST(testDetermineFilename_with_ContentDisposition_zero_length); - CPPUNIT_TEST(testDetermineFilename_with_ContentDisposition); - CPPUNIT_TEST(testGetRedirectURI_without_Location); - CPPUNIT_TEST(testGetRedirectURI_with_Location); - CPPUNIT_TEST(testIsRedirect); - CPPUNIT_TEST(testIsTransferEncodingSpecified); - CPPUNIT_TEST(testGetTransferEncoding); - CPPUNIT_TEST(testGetTransferEncodingStreamFilter); - CPPUNIT_TEST(testIsContentEncodingSpecified); - CPPUNIT_TEST(testGetContentEncoding); - CPPUNIT_TEST(testGetContentEncodingStreamFilter); - CPPUNIT_TEST(testValidateResponse); - CPPUNIT_TEST(testValidateResponse_good_range); - CPPUNIT_TEST(testValidateResponse_bad_range); - CPPUNIT_TEST(testValidateResponse_chunked); - CPPUNIT_TEST(testValidateResponse_withIfModifiedSince); - CPPUNIT_TEST(testProcessRedirect); - CPPUNIT_TEST(testRetrieveCookie); - CPPUNIT_TEST(testSupportsPersistentConnection); - CPPUNIT_TEST(testGetMetalinKHttpEntries); - CPPUNIT_TEST(testGetDigest); - CPPUNIT_TEST_SUITE_END(); - -private: -public: - void setUp() {} - - void testGetContentLength_null(); - void testGetContentLength_contentLength(); - void testGetEntityLength(); - void testGetContentType(); - void testDetermineFilename_without_ContentDisposition(); - void testDetermineFilename_with_ContentDisposition_zero_length(); - void testDetermineFilename_with_ContentDisposition(); - void testGetRedirectURI_without_Location(); - void testGetRedirectURI_with_Location(); - void testIsRedirect(); - void testIsTransferEncodingSpecified(); - void testGetTransferEncoding(); - void testGetTransferEncodingStreamFilter(); - void testIsContentEncodingSpecified(); - void testGetContentEncoding(); - void testGetContentEncodingStreamFilter(); - void testValidateResponse(); - void testValidateResponse_good_range(); - void testValidateResponse_bad_range(); - void testValidateResponse_chunked(); - void testValidateResponse_withIfModifiedSince(); - void testProcessRedirect(); - void testRetrieveCookie(); - void testSupportsPersistentConnection(); - void testGetMetalinKHttpEntries(); - void testGetDigest(); -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(HttpResponseTest); - -void HttpResponseTest::testGetContentLength_null() -{ - HttpResponse httpResponse; - - CPPUNIT_ASSERT_EQUAL((int64_t)0LL, httpResponse.getContentLength()); -} - -void HttpResponseTest::testGetContentLength_contentLength() -{ - HttpResponse httpResponse; - - auto httpHeader = make_unique(); - httpHeader->put(HttpHeader::CONTENT_LENGTH, "4294967296"); - - httpResponse.setHttpHeader(std::move(httpHeader)); - - CPPUNIT_ASSERT_EQUAL((int64_t)4294967296LL, httpResponse.getContentLength()); -} - -void HttpResponseTest::testGetEntityLength() -{ - HttpResponse httpResponse; - - auto httpHeader = make_unique(); - httpHeader->put(HttpHeader::CONTENT_LENGTH, "4294967296"); - - httpResponse.setHttpHeader(std::move(httpHeader)); - CPPUNIT_ASSERT_EQUAL((int64_t)4294967296LL, httpResponse.getEntityLength()); - - httpResponse.getHttpHeader()->put(HttpHeader::CONTENT_RANGE, - "bytes 1-4294967296/4294967297"); - CPPUNIT_ASSERT_EQUAL((int64_t)4294967297LL, httpResponse.getEntityLength()); -} - -void HttpResponseTest::testGetContentType() -{ - HttpResponse httpResponse; - auto httpHeader = make_unique(); - httpHeader->put(HttpHeader::CONTENT_TYPE, - "application/metalink+xml; charset=UTF-8"); - httpResponse.setHttpHeader(std::move(httpHeader)); - // See parameter is ignored. - CPPUNIT_ASSERT_EQUAL(std::string("application/metalink+xml"), - httpResponse.getContentType()); -} - -void HttpResponseTest::testDetermineFilename_without_ContentDisposition() -{ - HttpResponse httpResponse; - auto httpRequest = make_unique(); - auto request = std::make_shared(); - request->setUri("http://localhost/archives/aria2-1.0.0.tar.bz2"); - httpRequest->setRequest(request); - - httpResponse.setHttpHeader(make_unique()); - httpResponse.setHttpRequest(std::move(httpRequest)); - - CPPUNIT_ASSERT_EQUAL(std::string("aria2-1.0.0.tar.bz2"), - httpResponse.determineFilename(false)); -} - -void HttpResponseTest:: - testDetermineFilename_with_ContentDisposition_zero_length() -{ - HttpResponse httpResponse; - auto httpHeader = make_unique(); - httpHeader->put(HttpHeader::CONTENT_DISPOSITION, "attachment; filename=\"\""); - auto httpRequest = make_unique(); - auto request = std::make_shared(); - request->setUri("http://localhost/archives/aria2-1.0.0.tar.bz2"); - httpRequest->setRequest(request); - - httpResponse.setHttpHeader(std::move(httpHeader)); - httpResponse.setHttpRequest(std::move(httpRequest)); - - CPPUNIT_ASSERT_EQUAL(std::string("aria2-1.0.0.tar.bz2"), - httpResponse.determineFilename(false)); -} - -void HttpResponseTest::testDetermineFilename_with_ContentDisposition() -{ - HttpResponse httpResponse; - auto httpHeader = make_unique(); - httpHeader->put(HttpHeader::CONTENT_DISPOSITION, - "attachment; filename=\"aria2-current.tar.bz2\""); - auto httpRequest = make_unique(); - auto request = std::make_shared(); - request->setUri("http://localhost/archives/aria2-1.0.0.tar.bz2"); - httpRequest->setRequest(request); - - httpResponse.setHttpHeader(std::move(httpHeader)); - httpResponse.setHttpRequest(std::move(httpRequest)); - - CPPUNIT_ASSERT_EQUAL(std::string("aria2-current.tar.bz2"), - httpResponse.determineFilename(false)); -} - -void HttpResponseTest::testGetRedirectURI_without_Location() -{ - HttpResponse httpResponse; - - httpResponse.setHttpHeader(make_unique()); - - CPPUNIT_ASSERT_EQUAL(std::string(""), httpResponse.getRedirectURI()); -} - -void HttpResponseTest::testGetRedirectURI_with_Location() -{ - HttpResponse httpResponse; - auto httpHeader = make_unique(); - httpHeader->put(HttpHeader::LOCATION, - "http://localhost/download/aria2-1.0.0.tar.bz2"); - httpResponse.setHttpHeader(std::move(httpHeader)); - - CPPUNIT_ASSERT_EQUAL( - std::string("http://localhost/download/aria2-1.0.0.tar.bz2"), - httpResponse.getRedirectURI()); -} - -void HttpResponseTest::testIsRedirect() -{ - HttpResponse httpResponse; - httpResponse.setHttpHeader(make_unique()); - - httpResponse.getHttpHeader()->setStatusCode(301); - CPPUNIT_ASSERT(!httpResponse.isRedirect()); - - httpResponse.getHttpHeader()->setStatusCode(200); - CPPUNIT_ASSERT(!httpResponse.isRedirect()); - - httpResponse.getHttpHeader()->put( - HttpHeader::LOCATION, "http://localhost/download/aria2-1.0.0.tar.bz2"); - - CPPUNIT_ASSERT(!httpResponse.isRedirect()); - - httpResponse.getHttpHeader()->setStatusCode(300); - CPPUNIT_ASSERT(httpResponse.isRedirect()); - - httpResponse.getHttpHeader()->setStatusCode(301); - CPPUNIT_ASSERT(httpResponse.isRedirect()); - - httpResponse.getHttpHeader()->setStatusCode(302); - CPPUNIT_ASSERT(httpResponse.isRedirect()); - - httpResponse.getHttpHeader()->setStatusCode(303); - CPPUNIT_ASSERT(httpResponse.isRedirect()); - - httpResponse.getHttpHeader()->setStatusCode(304); - CPPUNIT_ASSERT(!httpResponse.isRedirect()); - - httpResponse.getHttpHeader()->setStatusCode(305); - CPPUNIT_ASSERT(!httpResponse.isRedirect()); - - httpResp \ No newline at end of file