mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Remove tests which are not used now
This commit is contained in:
parent
ee1c67811b
commit
ef1dbf0605
3 changed files with 0 additions and 123 deletions
|
@ -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'}
|
|
@ -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
|
Loading…
Add table
Reference in a new issue