seafdav/tests/test_litmus.py
Alexander Loechel dd53ecda00 Cleanup (#132)
* Cleanup repository configs

* more cleanup and convention checks

* apply black and isort

* fullfil conventions

* make a matrix test on travis

* correct travis rules

* merge my global isort config into setup.cfg, that is why local tests are green, and ci tests are red

* black did not work on Python2 so do not check-black on Python2.7

* fix isort behaviour so that black mode 3 is used
2018-10-03 22:04:24 +02:00

79 lines
2.6 KiB
Python

# -*- coding: utf-8 -*-
# (c) 2009-2018 Martin Wendt and contributors; see WsgiDAV https://github.com/mar10/wsgidav
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
"""
Run litmus against WsgiDAV server.
"""
from __future__ import print_function
from tests.util import WsgiDavTestServer
import subprocess
import unittest
# ========================================================================
# WsgiDAVServerTest
# ========================================================================
class WsgiDAVLitmusTest(unittest.TestCase):
"""Run litmus test suite against builtin server."""
def setUp(self):
pass
def tearDown(self):
pass
def _report_missing_litmus(self):
print("*" * 70)
print("This test requires the litmus test suite.")
print("See http://www.webdav.org/neon/litmus/")
print("*" * 70)
raise unittest.SkipTest("Test requires litmus test suite")
def test_litmus_with_authentication(self):
"""Run litmus test suite on HTTP with authentification."""
with WsgiDavTestServer(with_auth=True, with_ssl=False):
try:
res = subprocess.call(
["litmus", "http://127.0.0.1:8080/", "tester", "secret"]
)
self.assertEqual(res, 0, "litmus suite failed: check the log")
except OSError:
self._report_missing_litmus()
raise
return
def test_litmus_anonymous(self):
"""Run litmus test suite on HTTP with authentification."""
with WsgiDavTestServer(with_auth=False, with_ssl=False):
try:
res = subprocess.call(["litmus", "http://127.0.0.1:8080/"])
self.assertEqual(res, 0, "litmus suite failed: check the log")
except OSError:
self._report_missing_litmus()
raise
return
def test_litmus_with_ssl_and_authentication(self):
"""Run litmus test suite on SSL / HTTPS with authentification."""
with WsgiDavTestServer(with_auth=True, with_ssl=True):
try:
res = subprocess.call(
["litmus", "https://127.0.0.1:8080/", "tester", "secret"]
)
self.assertEqual(res, 0, "litmus suite failed: check the log")
except OSError:
self._report_missing_litmus()
raise
return
# ========================================================================
# suite
# ========================================================================
if __name__ == "__main__":
unittest.main()