Cors + Tests
This commit is contained in:
parent
5f590b2cb0
commit
a398b49a98
4 changed files with 5 additions and 9 deletions
|
|
@ -1,7 +1,6 @@
|
|||
from flask import Flask
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
import sys
|
||||
import os
|
||||
|
||||
db = SQLAlchemy()
|
||||
|
||||
|
|
@ -23,13 +22,9 @@ def create_app(flask_env='development'):
|
|||
else:
|
||||
print('ENV Variables passed : ', app.config['SQLALCHEMY_BINDS'])
|
||||
|
||||
print('init_app')
|
||||
db.init_app(app)
|
||||
with app.app_context():
|
||||
#print('import routes')
|
||||
from . import routes
|
||||
app.register_blueprint(routes.bp)
|
||||
#print('db.create_all')
|
||||
db.create_all()
|
||||
#print('db created')
|
||||
return app
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ def login():
|
|||
elif res['status'] == 1:
|
||||
user = None
|
||||
token = create_auth_token(user)
|
||||
return send_error(404, res['message'], token)
|
||||
return send_error(400, res['message'], token)
|
||||
else:
|
||||
return send_error(400, 'Empty email and/or password fields.')
|
||||
except KeyError as e:
|
||||
|
|
|
|||
|
|
@ -9,4 +9,5 @@ pipreqs==0.4.10
|
|||
PyJWT==2.3.0
|
||||
pytest==6.2.5
|
||||
SQLAlchemy==1.4.27
|
||||
psycopg2==2.9.2
|
||||
psycopg2==2.9.2
|
||||
Flask-Cors==3.0.10
|
||||
|
|
@ -66,7 +66,7 @@ class FlaskTestCase(BaseTestCase):
|
|||
"password": "nimp"
|
||||
}
|
||||
response = self.client.post('/api/login', json=data0)
|
||||
self.assertEqual(response.status_code, 404)
|
||||
self.assertEqual(response.status_code, 400)
|
||||
|
||||
def test_login_wrongFields_message(self):
|
||||
data0 = {
|
||||
|
|
@ -492,7 +492,7 @@ class FlaskTestCase(BaseTestCase):
|
|||
def test_adminDelete_noFields_statusCode(self):
|
||||
response = self.login('daisy@gmail.com', 'daisyPass')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
response = self.client.delete('/api/admin/delete/user')
|
||||
response = self.client.delete('/api/admin/delete/user/')
|
||||
self.assertEqual(response.status_code, 404)
|
||||
|
||||
def test_adminDelete_no_fields(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue