Commit 12201665 authored by Valentin Samir's avatar Valentin Samir

Add some dango unit tests

parent 5cb25de9
This diff is collapsed.
......@@ -19,6 +19,8 @@ from django.contrib import messages
import random
import string
import json
import BaseHTTPServer
from threading import Thread
from importlib import import_module
try:
......@@ -144,3 +146,32 @@ def gen_pgtiou():
def gen_saml_id():
"""Generate an saml id"""
return _gen_ticket('_')
class PGTUrlHandler(BaseHTTPServer.BaseHTTPRequestHandler):
PARAMS={}
def do_GET(s):
s.send_response(200)
s.send_header("Content-type", "text/plain")
s.end_headers()
s.wfile.write("ok")
url = urlparse(s.path)
params = dict(parse_qsl(url.query))
PGTUrlHandler.PARAMS.update(params)
s.wfile.write("%s" % params)
def log_message(self, format, *args):
return
@staticmethod
def run():
server_class = BaseHTTPServer.HTTPServer
httpd = server_class(("127.0.0.1", 0), PGTUrlHandler)
(host, port) = httpd.socket.getsockname()
def lauch():
httpd.handle_request()
#httpd.serve_forever()
httpd.server_close()
httpd_thread = Thread(target=lauch)
httpd_thread.daemon = True
httpd_thread.start()
return (httpd_thread, host, port)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment