Browse Source

Add resolve test

sqozz 1 year ago
parent
commit
51e8e32dee
1 changed files with 10 additions and 3 deletions
  1. 10
    3
      tests/functional_tests.py

+ 10
- 3
tests/functional_tests.py View File

@@ -33,6 +33,7 @@ class SchortBasicTests(unittest.TestCase, WebTestCase):
33 33
 		self.assertRegex(content, ".*\<html.*", msg="Didn't find an opening <html tag in the response.")
34 34
 		self.assertRegex(content, ".*\<div.*", msg="Didn't find any opening <div tag in the response.")
35 35
 
36
+
36 37
 class SchortRegressionTests(unittest.TestCase, WebTestCase):
37 38
 	def test_empty_wish_id(self):
38 39
 		"""Test a request with an empty wish-URL"""
@@ -52,18 +53,23 @@ class SchortShortLinkCase(object):
52 53
 	shortDest = ""
53 54
 	req = None
54 55
 
55
-	def test_resolve(self):
56
-		"""Test basic resolving capabilites of schort"""
56
+	def test_redirect(self):
57
+		"""Test basic redirecting capabilites of schort"""
57 58
 		self.assertNotEqual(len(self.shortID), 0)
58 59
 		req = self.assertGetStatusReq(301, BASE_URL + "/" + self.shortID)
59 60
 		loc = req.headers.get("location")
60 61
 		self.assertEqual(loc, self.shortDest)
61 62
 
62
-	def test_resolve_follow(self):
63
+	def test_redirect_follow(self):
63 64
 		"""Test if the requests-lib can follow the redirect"""
64 65
 		req = requests.get(BASE_URL + "/" + self.shortID, allow_redirects=True)
65 66
 		req.url = self.shortDest
66 67
 
68
+	def test_resolve(self):
69
+		"""Test the resolve parameter"""
70
+		req = self.assertGetReq(BASE_URL + "/" + self.shortID, params = {"resolve" : ""})
71
+		self.assertEqual(req.text, self.shortDest)
72
+
67 73
 	def test_HTMLresolve(self):
68 74
 		"""Test HTML displaying of the shortened URL"""
69 75
 		HTML_keyword = "+"
@@ -83,6 +89,7 @@ class SchortCustomIdTests(unittest.TestCase, SchortShortLinkCase, WebTestCase):
83 89
 		self.assertEqual(short_url, BASE_URL + "/" + self.shortID)
84 90
 		self.assertEqual(self.req.status_code, 200)
85 91
 
92
+
86 93
 class SchortRandomIdTests(unittest.TestCase, SchortShortLinkCase, WebTestCase):
87 94
 	def setUp(self):
88 95
 		"""Set up a short url with a randomly assigned id"""

Loading…
Cancel
Save