projects
/
fwx
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix a bug in default file not found handler, make creating Requests less painful...
[fwx]
/
src
/
test_fwx.py
diff --git
a/src/test_fwx.py
b/src/test_fwx.py
index
6f5eada
..
f437964
100644
(file)
--- a/
src/test_fwx.py
+++ b/
src/test_fwx.py
@@
-5,19
+5,15
@@
import fwx
class RequestTests(unittest.TestCase):
def test_GET(self):
class RequestTests(unittest.TestCase):
def test_GET(self):
- request = fwx.Request({
- 'PATH_INFO': '/',
+ request = fwx.Request('GET', '/', {
'QUERY_STRING': 'foo=bar&baz=qux',
'QUERY_STRING': 'foo=bar&baz=qux',
- 'REQUEST_METHOD': 'GET',
})
self.assertEqual(request.GET['foo'], ['bar'])
self.assertEqual(request.GET['baz'], ['qux'])
def test_parameters(self):
})
self.assertEqual(request.GET['foo'], ['bar'])
self.assertEqual(request.GET['baz'], ['qux'])
def test_parameters(self):
- request = fwx.Request({
- 'PATH_INFO': '/',
- 'REQUEST_METHOD': 'GET',
+ request = fwx.Request('GET', '/', {
'QUERY_STRING': 'foo=bar&baz=qux',
})
'QUERY_STRING': 'foo=bar&baz=qux',
})
@@
-144,10
+140,7
@@
class route_on_subpath_Tests(unittest.TestCase):
)
self.assertEqual(
)
self.assertEqual(
- router(fwx.Request({
- 'PATH_INFO': '/bar/bara/anne/',
- 'REQUEST_METHOD': 'GET',
- })).content,
+ router(fwx.Request('GET', '/bar/bara/anne/')).content,
'bar',
)
'bar',
)
@@
-161,10
+154,7
@@
class route_on_subpath_Tests(unittest.TestCase):
)
self.assertEqual(
)
self.assertEqual(
- router(fwx.Request({
- 'PATH_INFO': '/bar/bara/anne/',
- 'REQUEST_METHOD': 'GET',
- })).content,
+ router(fwx.Request('GET', '/bar/bara/anne/')).content,
'bara/anne/',
)
'bara/anne/',
)
@@
-178,12
+168,17
@@
class route_on_subpath_Tests(unittest.TestCase):
)
self.assertEqual(
)
self.assertEqual(
- router(fwx.Request({
- 'PATH_INFO': '/bar/bara/anne/',
- 'REQUEST_METHOD': 'GET',
- })).content,
+ router(fwx.Request('GET', '/bar/bara/anne/')).content,
'/bar/bara/anne/',
)
'/bar/bara/anne/',
)
+class default_file_not_found_Tests(unittest.TestCase):
+ def test_responds(self):
+ response = fwx.default_file_not_found_handler(
+ fwx.Request('GET', '/bar/bara/anne/'),
+ )
+
+ self.assertNotEqual(response, None)
+
if __name__ == '__main__':
unittest.main()
if __name__ == '__main__':
unittest.main()