Merge pull request #482 from alphagov/update-requirements

Update requirements
This commit is contained in:
Rebecca Law
2016-04-21 10:28:45 +01:00
11 changed files with 31 additions and 66 deletions

View File

@@ -1 +0,0 @@
web: python app.py runserver

View File

@@ -67,6 +67,10 @@ export ADMIN_CLIENT_USER_NAME='dev-notify-admin'
export API_HOST_NAME='http://localhost:6011'
export DANGEROUS_SALT='dev-notify-salt'
export SECRET_KEY='dev-notify-secret-key'
export DESKPRO_API_HOST=""
export DESKPRO_API_KEY=""
export DESKPRO_PERSON_EMAIL=""
export DESKPRO_TEAM_ID=""
"> environment.sh
```

View File

@@ -1,8 +1,8 @@
import os
import re
import dateutil
import urllib
import dateutil
from flask import (
Flask,
session,
@@ -13,34 +13,31 @@ from flask import (
current_app,
request)
from flask._compat import string_types
from flask.globals import _lookup_req_object
from flask_login import LoginManager
from flask_wtf import CsrfProtect
from functools import partial
from notifications_python_client.errors import HTTPError
from notifications_utils import logging
from notifications_utils.recipients import validate_phone_number, InvalidPhoneError
from pygments import highlight
from pygments.formatters.html import HtmlFormatter
from pygments.lexers.javascript import JavascriptLexer
from werkzeug.exceptions import abort
from werkzeug.local import LocalProxy
import app.proxy_fix
from app.asset_fingerprinter import AssetFingerprinter
from app.its_dangerous_session import ItsdangerousSessionInterface
from app.notify_client.api_client import ServiceAPIClient
from app.notify_client.api_key_api_client import ApiKeyApiClient
from app.notify_client.user_api_client import UserApiClient
from app.notify_client.invite_api_client import InviteApiClient
from app.notify_client.job_api_client import JobApiClient
from app.notify_client.notification_api_client import NotificationApiClient
from app.notify_client.status_api_client import StatusApiClient
from app.notify_client.invite_api_client import InviteApiClient
from app.notify_client.statistics_api_client import StatisticsApiClient
from app.notify_client.status_api_client import StatusApiClient
from app.notify_client.template_statistics_api_client import TemplateStatisticsApiClient
from app.its_dangerous_session import ItsdangerousSessionInterface
from app.asset_fingerprinter import AssetFingerprinter
from notifications_utils.recipients import validate_phone_number, InvalidPhoneError
import app.proxy_fix
from config import configs
from notifications_utils import logging
from werkzeug.local import LocalStack, LocalProxy
from flask.globals import _lookup_req_object
from functools import partial
from app.notify_client.user_api_client import UserApiClient
login_manager = LoginManager()
csrf = CsrfProtect()
@@ -108,6 +105,7 @@ def create_app():
def _attach_current_service():
return {'current_service': current_service}
application.context_processor(_attach_current_service)
register_errorhandlers(application)

View File

@@ -1,6 +1,6 @@
from flask import Blueprint
main = Blueprint('main', __name__)
main = Blueprint('main', __name__) # noqa
from app.main.views import (
index,

View File

@@ -1,10 +0,0 @@
from flask.ext.bcrypt import generate_password_hash, check_password_hash
def hashpw(password):
return generate_password_hash(password.encode('UTF-8'), 10)
def check_hash(password, hashed_password):
# If salt is invalid throws a 500 should add try/catch here
return check_password_hash(hashed_password, password)

View File

@@ -1,7 +1,5 @@
import re
from wtforms import ValidationError
from datetime import datetime
from app.main.encryption import check_hash
from notifications_utils.template import Template

View File

@@ -2,4 +2,4 @@ from flask import Blueprint
status = Blueprint('status', __name__)
from app.status.views import healthcheck
from app.status.views import healthcheck # noqa

View File

@@ -1,15 +1,9 @@
Flask==0.10.1
Flask-Script==2.0.5
Flask-Migrate==1.3.1
Flask-SQLAlchemy==2.0
psycopg2==2.6.1
SQLAlchemy==1.0.5
SQLAlchemy-Utils==0.30.5
Flask-WTF==0.11
Flask-Login==0.2.11
Flask-Bcrypt==0.6.2
credstash==1.8.0
boto3==1.2.3
boto3==1.3.0
Pygments==2.0.2
py-gfm==0.1.2

View File

@@ -1,9 +1,9 @@
-r requirements.txt
pep8==1.5.7
pytest==2.8.1
pytest-mock==0.8.1
pep8==1.7.0
pytest==2.9.1
pytest-mock==0.11.0
pytest-cov==2.2.1
coveralls==1.1
moto==0.4.19
httpretty==0.8.10
moto==0.4.23
httpretty==0.8.14
beautifulsoup4==4.4.1

View File

@@ -1,17 +0,0 @@
from app.main.encryption import hashpw, check_hash
def test_should_hash_password():
password = 'passwordToHash'
assert password != hashpw(password)
def test_should_check_password():
value = 's3curePassword!'
encrypted = hashpw(value)
assert check_hash(value, encrypted) is True
def test_checkpw_should_fail_when_pw_does_not_match():
value = hashpw('somePassword')
assert check_hash('somethingDifferent', value) is False

11
wsgi.py
View File

@@ -1,6 +1,10 @@
from credstash import getAllSecrets
import os
from credstash import getAllSecrets
from app import create_app
from config import configs
default_env_file = '/home/ubuntu/environment'
environment = 'live'
@@ -8,16 +12,11 @@ if os.path.isfile(default_env_file):
with open(default_env_file, 'r') as environment_file:
environment = environment_file.readline().strip()
# on aws get secrets and export to env
os.environ.update(getAllSecrets(region="eu-west-1"))
from config import configs
os.environ['NOTIFY_ADMIN_ENVIRONMENT'] = configs[environment]
from app import create_app
application = create_app()
if __name__ == "__main__":