Test static serving of files.

pull/7/head
Ferry Boender 10 years ago
parent 61c858dad2
commit 9cc8ffb841
  1. BIN
      test/static/ssh_server.png
  2. 10
      test/test.py
  3. 1
      test/test_webapp.json

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

@ -299,6 +299,16 @@ class WebAppTest(unittest.TestCase):
self.assertIn('SAME', r.text) self.assertIn('SAME', r.text)
os.unlink('data.raw') os.unlink('data.raw')
def testStatic(self):
r = requests.get("http://localhost:8002/static?fname=ssh_server.png", auth=self.auth_user)
self.assertEquals(r.status_code, 200)
f_served = b''
for c in r.iter_content():
f_served += c
f_orig = file('static/ssh_server.png', 'rb').read()
self.assertEquals(f_orig, f_served)
if __name__ == '__main__': if __name__ == '__main__':
import coverage import coverage

@ -4,6 +4,7 @@
"admin": "8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918", "admin": "8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918",
"user": "04f8996da763b7a969b1028ee3007569eaf3a635486ddab211d512c85b9df8fb" "user": "04f8996da763b7a969b1028ee3007569eaf3a635486ddab211d512c85b9df8fb"
}, },
"static_dir": "static",
"forms": [ "forms": [
{ {
"name": "admin_only", "name": "admin_only",

Loading…
Cancel
Save