diff options
author | Andrei Belov <defan@nginx.com> | 2019-10-03 17:46:28 +0300 |
---|---|---|
committer | Andrei Belov <defan@nginx.com> | 2019-10-03 17:46:28 +0300 |
commit | 3dd3f861f4c3aa320aa137802f033f8f1fc7dc41 (patch) | |
tree | 357577c560920eb0f5837b7d073999f5c7a1a2cd /test/test_static.py | |
parent | 9de7aea721245cda9f079a2b29d8efaf99c440fd (diff) | |
parent | 59db9a3887211fccdaec04b7952ad0140090de22 (diff) | |
download | unit-3dd3f861f4c3aa320aa137802f033f8f1fc7dc41.tar.gz unit-3dd3f861f4c3aa320aa137802f033f8f1fc7dc41.tar.bz2 |
Merged with the default branch.
Diffstat (limited to '')
-rw-r--r-- | test/test_static.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/test_static.py b/test/test_static.py index 573669a3..4bdd83ed 100644 --- a/test/test_static.py +++ b/test/test_static.py @@ -1,4 +1,5 @@ import os +import socket import unittest from unit.applications.proto import TestApplicationProto @@ -169,6 +170,29 @@ class TestStatic(TestApplicationProto): self.get(url='/ди ректория/фа йл')['body'], 'blah', 'dir name 2' ) + def test_static_unix_socket(self): + sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + sock.bind(self.testdir + '/assets/unix_socket') + + self.assertEqual(self.get(url='/unix_socket')['status'], 404, 'socket') + + sock.close() + + def test_static_unix_fifo(self): + os.mkfifo(self.testdir + '/assets/fifo') + + self.assertEqual(self.get(url='/fifo')['status'], 404, 'fifo') + + def test_static_symlink(self): + os.symlink(self.testdir + '/assets/dir', self.testdir + '/assets/link') + + self.assertEqual(self.get(url='/dir')['status'], 301, 'dir') + self.assertEqual(self.get(url='/dir/file')['status'], 200, 'file') + self.assertEqual(self.get(url='/link')['status'], 301, 'symlink dir') + self.assertEqual( + self.get(url='/link/file')['status'], 200, 'symlink file' + ) + def test_static_head(self): resp = self.head(url='/') self.assertEqual(resp['status'], 200, 'status') |