Example #1
0
	def test_get_webpage_return_minus_1_on_null_url(self):
		with pytest.raises(Exception) as exc:
			runner.get_webpage()
		assert exc.typename == "TypeError"
Example #2
0
	def test_get_webpage_return_minus_1_on_bad_schema(self):
		result = runner.get_webpage('hrrp://www.hello.com')
		assert result == -1
Example #3
0
	def test_get_webpage_return_minus_1_on_integer_url(self):
		result = runner.get_webpage(1)
		assert result == -1
Example #4
0
	def test_get_webpage_return_minus_1_on_missing_schema(self):
		result = runner.get_webpage('sdnasdcnadsjkncadkscjna')
		assert result == -1
Example #5
0
	def test_get_webpage_return_404_on_non_existent_webpage(self):
		result = runner.get_webpage('http://www.google.com/asdasdasd/asdasda/asdasdaddasd/html')
		assert result == 404
Example #6
0
	def test_get_webpage_get_lots_of_pages_quickly(self):
		times_to_run = 40
		result = [runner.get_webpage('http://www.google.com') for x in range(times_to_run)]
		assert len(result) == times_to_run
		for x in result:
			assert x == 200
Example #7
0
	def test_get_webpage_return_200_on_good_webpage(self):
		result = runner.get_webpage('http://www.google.com')
		assert result == 200
Example #8
0
	def test_get_webpage_return_integer(self):
		result = runner.get_webpage('http://www.google.com')
		assert isinstance(result, int)