annotate tests/suite_03_good_forward/__init__.py @ 71:88adf10be709 draft

Add tests.
author David Barts <n5jrn@me.com>
date Mon, 15 Jul 2019 13:16:31 -0700
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
71
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
1 # I m p o r t s
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
2
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
3 import os, sys
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
4 import requests
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
5 from .. import ServerFixture, RoutesFixture
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
6
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
7 # C l a s s e s
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
8
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
9 class Fixture01(RoutesFixture):
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
10 # Same directory
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
11 def test_01_same(self):
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
12 response = requests.get("http://localhost:{0}/same.pspx".format(self.port))
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
13 self.assertEqual(response.status_code, 200)
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
14 self.assertTrue("This is the original page." in response.text)
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
15
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
16 # Relative, with .
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
17 def test_02_relative_dot(self):
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
18 response = requests.get("http://localhost:{0}/relative.pspx".format(self.port))
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
19 self.assertEqual(response.status_code, 200)
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
20 self.assertTrue("This is the original page." in response.text)
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
21
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
22 # Relative, with ..
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
23 def test_03_relative_dotdot(self):
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
24 response = requests.get("http://localhost:{0}/subdir/relative.pspx".format(self.port))
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
25 self.assertEqual(response.status_code, 200)
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
26 self.assertTrue("This is the original page." in response.text)
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
27
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
28 # Absolute
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
29 def test_04_absolute(self):
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
30 response = requests.get("http://localhost:{0}/subdir/absolute.pspx".format(self.port))
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
31 self.assertEqual(response.status_code, 200)
88adf10be709 Add tests.
David Barts <n5jrn@me.com>
parents:
diff changeset
32 self.assertTrue("This is the original page." in response.text)