Example #1
0
    def testHTMLSuffix(self):
        # https://example.com/hello.html
        # 	domain = example.com
        # 	url_path = hello.html
        # 	save_path = ${DOWNLOAD_DIR}/example.com/hello.html
        url = "https://example.com/hello.html"
        (domain, url_path) = SavePagePipeline._parse_url(url)

        self.assertEqual(domain, "example.com")
        self.assertEqual(url_path, "hello.html")
Example #2
0
    def testRoot(self):
        # https://example.com/
        # 	domain = example.com
        # 	url_path = index.html
        # 	save_path = ${DOWNLOAD_DIR}/example.com/index.html
        url = "https://example.com/"
        (domain, url_path) = SavePagePipeline._parse_url(url)

        self.assertEqual(domain, "example.com")
        self.assertEqual(url_path, "index.html")
Example #3
0
    def testNested(self):
        # https://example.com/foo/bar.php
        # 	domain = example.com
        # 	url_path = foo/bar.php.html
        # 	save_path = ${DOWNLOAD_DIR}/example.com/foo/bar.php.html
        url = "https://example.com/foo/bar.php"
        (domain, url_path) = SavePagePipeline._parse_url(url)

        self.assertEqual(domain, "example.com")
        self.assertEqual(url_path, "foo/bar.php.html")