From ef1dbf06057d9fe31e8c765bf92ba45cac7906fc Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Fri, 28 Jun 2019 19:54:58 +0200 Subject: [PATCH] Remove tests which are not used now --- lib/test/__init__.py | 0 lib/test/test.py | 23 ---------- tests/test_api.py | 100 ------------------------------------------- 3 files changed, 123 deletions(-) delete mode 100755 lib/test/__init__.py delete mode 100644 lib/test/test.py delete mode 100644 tests/test_api.py diff --git a/lib/test/__init__.py b/lib/test/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/lib/test/test.py b/lib/test/test.py deleted file mode 100644 index 04e88fe1..00000000 --- a/lib/test/test.py +++ /dev/null @@ -1,23 +0,0 @@ - -def test_non_auth(): - return {'action': 'non-auth'} - -def test_auth(auth): - return {'action': 'auth', - 'authenticator': 'default', 'authenticate': 'all'} - -def test_auth_profile(auth): - return {'action': 'auth-profile', - 'authenticator': 'test-profile', 'authenticate': 'all'} - -def test_auth_cli(): - return {'action': 'auth-cli', - 'authenticator': 'default', 'authenticate': ['cli']} - -def test_anonymous(): - return {'action': 'anonymous', - 'authenticator': 'ldap-anonymous', 'authenticate': 'all'} - -def test_root(): - return {'action': 'root-auth', - 'authenticator': 'as-root', 'authenticate': 'all'} diff --git a/tests/test_api.py b/tests/test_api.py deleted file mode 100644 index 955fa577..00000000 --- a/tests/test_api.py +++ /dev/null @@ -1,100 +0,0 @@ -# -*- coding: utf-8 -*- - -from webtest import TestApp as WebTestApp -from bottle import Bottle -from moulinette.interfaces.api import filter_csrf - - -URLENCODED = 'application/x-www-form-urlencoded' -FORMDATA = 'multipart/form-data' -TEXT = 'text/plain' - -TYPES = [URLENCODED, FORMDATA, TEXT] -SAFE_METHODS = ["HEAD", "GET", "PUT", "DELETE"] - - -app = Bottle(autojson=True) -app.install(filter_csrf) - - -@app.get('/') -def get_hello(): - return "Hello World!\n" - - -@app.post('/') -def post_hello(): - return "OK\n" - - -@app.put('/') -def put_hello(): - return "OK\n" - - -@app.delete('/') -def delete_hello(): - return "OK\n" - - -webtest = WebTestApp(app) - - -def test_get(): - r = webtest.get("/") - assert r.status_code == 200 - - -def test_csrf_post(): - r = webtest.post("/", "test", expect_errors=True) - assert r.status_code == 403 - - -def test_post_json(): - r = webtest.post("/", "test", - headers=[("Content-Type", "application/json")]) - assert r.status_code == 200 - - -def test_csrf_post_text(): - r = webtest.post("/", "test", - headers=[("Content-Type", "text/plain")], - expect_errors=True) - assert r.status_code == 403 - - -def test_csrf_post_urlencoded(): - r = webtest.post("/", "test", - headers=[("Content-Type", - "application/x-www-form-urlencoded")], - expect_errors=True) - assert r.status_code == 403 - - -def test_csrf_post_form(): - r = webtest.post("/", "test", - headers=[("Content-Type", "multipart/form-data")], - expect_errors=True) - assert r.status_code == 403 - - -def test_ok_post_text(): - r = webtest.post("/", "test", - headers=[("Content-Type", "text/plain"), - ("X-Requested-With", "XMLHttpRequest")]) - assert r.status_code == 200 - - -def test_ok_post_urlencoded(): - r = webtest.post("/", "test", - headers=[("Content-Type", - "application/x-www-form-urlencoded"), - ("X-Requested-With", "XMLHttpRequest")]) - assert r.status_code == 200 - - -def test_ok_post_form(): - r = webtest.post("/", "test", - headers=[("Content-Type", "multipart/form-data"), - ("X-Requested-With", "XMLHttpRequest")]) - assert r.status_code == 200