else: owner = '<D:owner xmlns:D="DAV:" />' return shared, owner if __name__ == '__main__': print "Unit tests" import tempfile, shutil config.root_dir = tempfile.mkdtemp(prefix = 'easydav-') testfile = os.path.join(config.root_dir, u'testfile%ä') open(testfile, 'w').write('foo') mgr = LockManager() lock = mgr.create_lock(u'testfile%ä', True, '', -1, 100) req = RequestInfo({ 'HTTP_HOST': 'example.com', 'REQUEST_URI': '/webdav.cgi/testfile%25%C3%A4', 'PATH_INFO': '/testfile%\xc3\xa4', 'HTTP_IF': '(<' + lock.urn + '>)', 'wsgi.input': None }) # When holding the lock assert req.get_request_path('r') assert req.get_request_path('w') mgr.release_lock(lock.path, lock.urn) lock = mgr.create_lock(u'testfile%ä', True, '', -1, 100)