Start validating login in CNR
Fixes https://www.pivotaltracker.com/story/show/142342305
This commit is contained in:
parent
20306ef0f6
commit
c9a5ce6701
2 changed files with 42 additions and 7 deletions
30
endpoints/appr/test/test_registry.py
Normal file
30
endpoints/appr/test/test_registry.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
import json
|
||||
import pytest
|
||||
|
||||
from flask import url_for
|
||||
|
||||
from data import model
|
||||
from endpoints.test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file
|
||||
from endpoints.appr.registry import appr_bp
|
||||
|
||||
def test_invalid_login(app, client):
|
||||
app.register_blueprint(appr_bp, url_prefix='/cnr')
|
||||
|
||||
url = url_for('appr.login')
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
data = {'user': {'username': 'foo', 'password': 'bar'}}
|
||||
|
||||
rv = client.open(url, method='POST', data=json.dumps(data), headers=headers)
|
||||
assert rv.status_code == 401
|
||||
|
||||
|
||||
def test_valid_login(app, client):
|
||||
app.register_blueprint(appr_bp, url_prefix='/cnr')
|
||||
|
||||
url = url_for('appr.login')
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
data = {'user': {'username': 'devtable', 'password': 'password'}}
|
||||
|
||||
rv = client.open(url, method='POST', data=json.dumps(data), headers=headers)
|
||||
assert rv.status_code == 200
|
||||
|
Reference in a new issue