mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Merge branch 'master' into post-sms-v2
This commit is contained in:
1
Makefile
1
Makefile
@@ -64,6 +64,7 @@ generate-version-file: ## Generates the app version file
|
||||
|
||||
.PHONY: build
|
||||
build: dependencies generate-version-file ## Build project
|
||||
./venv/bin/pip-accel wheel --wheel-dir=wheelhouse -r requirements.txt
|
||||
|
||||
.PHONY: build-codedeploy-artifact
|
||||
build-codedeploy-artifact: ## Build the deploy artifact for CodeDeploy
|
||||
|
||||
@@ -123,6 +123,7 @@ class Service(db.Model, Versioned):
|
||||
backref=db.backref('user_to_service', lazy='dynamic'))
|
||||
restricted = db.Column(db.Boolean, index=False, unique=False, nullable=False)
|
||||
research_mode = db.Column(db.Boolean, index=False, unique=False, nullable=False, default=False)
|
||||
can_send_letters = db.Column(db.Boolean, nullable=False, default=False)
|
||||
email_from = db.Column(db.Text, index=False, unique=True, nullable=False)
|
||||
created_by = db.relationship('User')
|
||||
created_by_id = db.Column(UUID(as_uuid=True), db.ForeignKey('users.id'), index=True, nullable=False)
|
||||
|
||||
@@ -20,6 +20,7 @@ RUN \
|
||||
echo "Install global pip packages" \
|
||||
&& pip install \
|
||||
virtualenv \
|
||||
awscli
|
||||
awscli \
|
||||
wheel
|
||||
|
||||
WORKDIR /var/project
|
||||
|
||||
24
migrations/versions/0058_add_letters_flag.py
Normal file
24
migrations/versions/0058_add_letters_flag.py
Normal file
@@ -0,0 +1,24 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: 0058_add_letters_flag
|
||||
Revises: 0057_change_email_template
|
||||
Create Date: 2016-10-25 17:37:27.660723
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0058_add_letters_flag'
|
||||
down_revision = '0057_change_email_template'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('services', sa.Column('can_send_letters', sa.Boolean(), nullable=False, server_default=sa.false()))
|
||||
op.add_column('services_history', sa.Column('can_send_letters', sa.Boolean(), nullable=False, server_default=sa.false()))
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('services_history', 'can_send_letters')
|
||||
op.drop_column('services', 'can_send_letters')
|
||||
@@ -20,6 +20,6 @@ statsd==3.2.1
|
||||
|
||||
git+https://github.com/alphagov/notifications-python-client.git@1.3.0#egg=notifications-python-client==1.3.0
|
||||
|
||||
git+https://github.com/alphagov/notifications-utils.git@9.0.5#egg=notifications-utils==9.0.5
|
||||
git+https://github.com/alphagov/notifications-utils.git@9.1.1#egg=notifications-utils==9.1.1
|
||||
|
||||
git+https://github.com/alphagov/boto.git@2.42.0-patch2#egg=boto==2.42.0-patch2
|
||||
|
||||
@@ -5,4 +5,4 @@ set -eo pipefail
|
||||
echo "Install dependencies"
|
||||
|
||||
cd /home/notify-app/notifications-api;
|
||||
pip3 install -r /home/notify-app/notifications-api/requirements.txt
|
||||
pip3 install --find-links=wheelhouse -r /home/notify-app/notifications-api/requirements.txt
|
||||
|
||||
@@ -193,6 +193,7 @@ def test_create_service(notify_api, sample_user):
|
||||
json_resp = json.loads(resp.get_data(as_text=True))
|
||||
assert json_resp['data']['name'] == 'created service'
|
||||
assert not json_resp['data']['research_mode']
|
||||
assert not json_resp['data']['can_send_letters']
|
||||
|
||||
|
||||
def test_should_not_create_service_with_missing_user_id_field(notify_api, fake_uuid):
|
||||
@@ -376,7 +377,7 @@ def test_update_service(notify_api, notify_db, sample_service):
|
||||
assert result['data']['organisation'] == str(org.id)
|
||||
|
||||
|
||||
def test_update_service_research_mode(notify_api, sample_service):
|
||||
def test_update_service_flags(notify_api, sample_service):
|
||||
with notify_api.test_request_context():
|
||||
with notify_api.test_client() as client:
|
||||
auth_header = create_authorization_header()
|
||||
@@ -387,10 +388,12 @@ def test_update_service_research_mode(notify_api, sample_service):
|
||||
json_resp = json.loads(resp.get_data(as_text=True))
|
||||
assert resp.status_code == 200
|
||||
assert json_resp['data']['name'] == sample_service.name
|
||||
assert not json_resp['data']['research_mode']
|
||||
assert json_resp['data']['research_mode'] is False
|
||||
assert json_resp['data']['can_send_letters'] is False
|
||||
|
||||
data = {
|
||||
'research_mode': True
|
||||
'research_mode': True,
|
||||
'can_send_letters': True
|
||||
}
|
||||
|
||||
auth_header = create_authorization_header()
|
||||
@@ -402,7 +405,8 @@ def test_update_service_research_mode(notify_api, sample_service):
|
||||
)
|
||||
result = json.loads(resp.get_data(as_text=True))
|
||||
assert resp.status_code == 200
|
||||
assert result['data']['research_mode']
|
||||
assert result['data']['research_mode'] is True
|
||||
assert result['data']['can_send_letters'] is True
|
||||
|
||||
|
||||
def test_update_service_research_mode_throws_validation_error(notify_api, sample_service):
|
||||
|
||||
Reference in New Issue
Block a user