예제 #1
0
파일: test_page.py 프로젝트: cessor/scrape
	def test_should_return_recursive_results_when_the_content_type_contains_encoding(self):
		html = """<div id="content">
				<a href="view.php?id=1111">Page</a>
			</div>
		"""
		web = FakeWebResponses()
		markup = parse(html)
		page = Page(markup, web)
		file = page.resources()[0]

		self.assertEqual("File 1", file.name)
		self.assertEqual("http://elearning.uni-heidelberg.de/mod/resource/view.php?id=123", file.url)
예제 #2
0
파일: test_page.py 프로젝트: cessor/scrape
	def test_print_the_appropriate_pages(self):
		html = """<div id="content">
			<a href="view.php?id=123">File</a>
			<a href="view.php?id=345">Page</a>
			<a href="view.php?id=567">File</a>
			</div>
		"""
		web = FakeWebResponses()
		markup = parse(html)
		page = Page(markup, web)
		file = page.resources()[0]

		self.assertEqual("File", file.name)
		self.assertEqual("http://elearning.uni-heidelberg.de/mod/resource/view.php?id=123", file.url)
예제 #3
0
파일: test_page.py 프로젝트: cessor/scrape
	def test_the_weasel_recursive(self):
		html = """<div id="content">
			<a href="view.php?id=123">File</a>
			<a href="view.php?id=345">Page</a>
			<a href="view.php?id=567">File</a>
			</div>
		"""
		web = FakeWebResponses()

		markup = parse(html)
		page = Page(markup, web)

		files = page.resources()
		self.assertEqual(4, len(files))