Commit 659abcb1 authored by Jonathan Schaeffer's avatar Jonathan Schaeffer
Browse files

Make the tests pass

parent fc178452
......@@ -6,5 +6,4 @@ test:
- pip install -r requirements.txt
- pip install pytest-cov
- pip install --editable .
- pytest
- pytest --cov=eidawsauth
......@@ -8,7 +8,7 @@ class default():
ENVIRONMENT='default'
EMAIL='resif-dc@univ-grenoble-alpes.fr'
GNUPGHOMEDIR='/gnupg'
GNUPGHOMEDIR='../../tests/test_files/gpg_home'
AUTHDBPORT=5432
AUTHDBHOST='localhost'
......
......@@ -14,8 +14,10 @@ from version import __version__
application = Flask(__name__)
if 'RUNMODE' in os.environ and os.environ['RUNMODE'] == 'production':
application.config.from_object(configurations.production.config)
else:
elif 'RUNMODE' in os.environ and os.environ['RUNMODE'] == 'development':
application.config.from_object(configurations.development.config)
else:
application.config.from_object(configurations.default.default)
from logging.config import dictConfig
dictConfig({
......
......@@ -57,11 +57,13 @@ def test_auth_post_old_token(client, gpg):
assert rv.status_code == 415
def test_auth_post_valid_token(client, gpg):
content = '{"valid_until": "2020-03-19T09:07:10.096722Z", "cn": "Jonathan SCHAEFFER", "memberof": "/epos;/", "sn": "SCHAEFFER", "issued": "2019-03-18T09:07:10.096727Z", "mail": "jonathan.schaeffer@univ-grenoble-alpes.fr", "givenName": "Jonathan", "expiration": "1d"}'
token = str(gpg.sign(content))
rv = client.post('/',data=token)
assert rv.status_code == 200
if 'RUNMODE' in os.environ and os.environ['RUNMODE'] == 'development':
content = '{"valid_until": "2020-03-19T09:07:10.096722Z", "cn": "Jonathan SCHAEFFER", "memberof": "/epos;/", "sn": "SCHAEFFER", "issued": "2019-03-18T09:07:10.096727Z", "mail": "jonathan.schaeffer@univ-grenoble-alpes.fr", "givenName": "Jonathan", "expiration": "1d"}'
token = str(gpg.sign(content))
rv = client.post('/',data=token)
assert rv.status_code == 200
def test_cleanup(client):
rv = client.get('/cleanup')
assert rv.status_code == 200
if 'RUNMODE' in os.environ and os.environ['RUNMODE'] == 'development':
rv = client.get('/cleanup')
assert rv.status_code == 200
Supports Markdown
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