uupdate tests

This commit is contained in:
Guillaume Tassery 2019-09-27 05:15:03 +02:00
parent 7c93ef1706
commit b1182cdc3d

View File

@ -9,9 +9,9 @@ import csv
# Decorator used to see if authentification works for external dictionary who use a HTTP source. # Decorator used to see if authentification works for external dictionary who use a HTTP source.
def check_auth(fn): def check_auth(fn):
def wrapper(req): def wrapper(req):
auth_header = self.headers.get('Authorization', None) auth_header = req.headers.get('authorization', None)
api_key = self.headers.get('api-key', None) api_key = req.headers.get('api-key', None)
if not auth_header or auth_header != 'Zm9vOmJhcg==' or not api_key or api_key != 'secret': if not auth_header or auth_header != 'Basic Zm9vOmJhcg==' or not api_key or api_key != 'secret':
req.send_response(401) req.send_response(401)
else: else:
fn(req) fn(req)