Пример #1
0
	def test_getReferrerFromRequest_UrlWithoutReferrer_ReturnsNone(self):
		"""
		If a request with no referrer is passed in, None is returned
		"""

		r = HttpRequest()
		r.method == "GET"
		r.path == '/magic'

		referrer = views.getReferrerFromRequest(r)
		self.assertEqual(referrer, None)
Пример #2
0
	def test_getReferrerFromRequest_Url_GetsReferrer(self):
		"""
		Given a URL request, returns the referrer
		"""

		r = HttpRequest()
		r.method == "GET"
		r.path == '/magic'
		r.META["HTTP_REFERER"] = 'test referrer'

		referrer = views.getReferrerFromRequest(r)
		self.assertEqual(referrer, 'test referrer')