diff --git a/requirements.txt b/requirements.txt index 9b28fa639..c20f36570 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -boto3==1.4.8 +boto3==1.5.6 cffi==1.11.0 # pyup: != 1.11.1, != 1.11.2 # These versions are missing .whl celery==3.1.25 # pyup: <4 docopt==0.6.2 @@ -17,18 +17,14 @@ monotonic==1.4 psycopg2==2.7.3.2 PyJWT==1.5.3 SQLAlchemy-Utils==0.32.21 -SQLAlchemy==1.1.15 -statsd==3.2.1 +SQLAlchemy==1.2.0 -notifications-python-client==4.6.0 +notifications-python-client==4.7.1 # PaaS -awscli==1.14.4 +awscli==1.14.16 awscli-cwlogs>=1.4,<1.5 -git+https://github.com/alphagov/notifications-utils.git@23.3.4#egg=notifications-utils==23.3.4 +git+https://github.com/alphagov/notifications-utils.git@23.3.5#egg=notifications-utils==23.3.5 git+https://github.com/alphagov/boto.git@2.43.0-patch3#egg=boto==2.43.0-patch3 - -# required by utils -git+https://github.com/leohemsted/smartypants.py.git@regex-speedup#egg=smartypants==2.1.0 diff --git a/requirements_for_test.txt b/requirements_for_test.txt index 01b31a53a..00506f33f 100644 --- a/requirements_for_test.txt +++ b/requirements_for_test.txt @@ -3,7 +3,7 @@ flake8==3.5.0 pytest==3.3.1 pytest-mock==1.6.3 pytest-cov==2.5.1 -pytest-xdist==1.20.1 +pytest-xdist==1.21.0 coveralls==1.2.0 freezegun==0.3.9 requests-mock==1.4.0 diff --git a/tests/app/conftest.py b/tests/app/conftest.py index e51aedd7d..bf675ed2b 100644 --- a/tests/app/conftest.py +++ b/tests/app/conftest.py @@ -57,8 +57,7 @@ from tests.app.db import ( create_service, create_api_key, create_inbound_number, - create_letter_contact, - create_inbound_sms, + create_letter_contact ) @@ -649,16 +648,6 @@ def sample_email_notification(notify_db, notify_db_session): return notification -@pytest.fixture(scope='function') -def mock_statsd_inc(mocker): - return mocker.patch('app.statsd_client.incr') - - -@pytest.fixture(scope='function') -def mock_statsd_timing(mocker): - return mocker.patch('app.statsd_client.timing') - - @pytest.fixture(scope='function') def sample_notification_history( notify_db, @@ -1048,18 +1037,13 @@ def sample_provider_rate(notify_db, notify_db_session, valid_from=None, rate=Non @pytest.fixture def sample_inbound_numbers(notify_db, notify_db_session, sample_service): service = create_service(service_name='sample service 2') - inbound_numbers = [] + inbound_numbers = list() inbound_numbers.append(create_inbound_number(number='1', provider='mmg')) inbound_numbers.append(create_inbound_number(number='2', provider='mmg', active=False, service_id=service.id)) inbound_numbers.append(create_inbound_number(number='3', provider='firetext', service_id=sample_service.id)) return inbound_numbers -@pytest.fixture -def sample_inbound_sms(notify_db, notify_db_session, sample_service): - return create_inbound_sms(sample_service) - - @pytest.fixture def restore_provider_details(notify_db, notify_db_session): """ diff --git a/tests/app/dao/test_inbound_sms_dao.py b/tests/app/dao/test_inbound_sms_dao.py index 8c8d0305f..c74abb1b5 100644 --- a/tests/app/dao/test_inbound_sms_dao.py +++ b/tests/app/dao/test_inbound_sms_dao.py @@ -90,25 +90,28 @@ def test_should_not_delete_inbound_sms_before_seven_days(sample_service): assert len(InboundSms.query.all()) == 2 -def test_get_inbound_sms_by_id_returns(sample_inbound_sms): - inbound_from_db = dao_get_inbound_sms_by_id(sample_inbound_sms.service.id, sample_inbound_sms.id) +def test_get_inbound_sms_by_id_returns(sample_service): + inbound_sms = create_inbound_sms(service=sample_service) + inbound_from_db = dao_get_inbound_sms_by_id(inbound_sms.service.id, inbound_sms.id) - assert sample_inbound_sms == inbound_from_db + assert inbound_sms == inbound_from_db -def test_dao_get_paginated_inbound_sms_for_service(sample_inbound_sms): - inbound_from_db = dao_get_paginated_inbound_sms_for_service(sample_inbound_sms.service.id) +def test_dao_get_paginated_inbound_sms_for_service(sample_service): + inbound_sms = create_inbound_sms(service=sample_service) + inbound_from_db = dao_get_paginated_inbound_sms_for_service(inbound_sms.service.id) - assert sample_inbound_sms == inbound_from_db[0] + assert inbound_sms == inbound_from_db[0] -def test_dao_get_paginated_inbound_sms_for_service_return_only_for_service(sample_inbound_sms): +def test_dao_get_paginated_inbound_sms_for_service_return_only_for_service(sample_service): + inbound_sms = create_inbound_sms(service=sample_service) another_service = create_service(service_name='another service') another_inbound_sms = create_inbound_sms(another_service) - inbound_from_db = dao_get_paginated_inbound_sms_for_service(sample_inbound_sms.service.id) + inbound_from_db = dao_get_paginated_inbound_sms_for_service(inbound_sms.service.id) - assert sample_inbound_sms in inbound_from_db + assert inbound_sms in inbound_from_db assert another_inbound_sms not in inbound_from_db diff --git a/tests/app/db.py b/tests/app/db.py index 922493b23..50926481b 100644 --- a/tests/app/db.py +++ b/tests/app/db.py @@ -126,7 +126,6 @@ def create_template( template_name=None, subject='Template subject', content='Dear Sir/Madam, Hello. Yours Truly, The Government.', - template_id=None, reply_to=None ): data = { diff --git a/tests/app/v2/inbound_sms/test_get_inbound_sms.py b/tests/app/v2/inbound_sms/test_get_inbound_sms.py index e499089c3..dfd4ae0b9 100644 --- a/tests/app/v2/inbound_sms/test_get_inbound_sms.py +++ b/tests/app/v2/inbound_sms/test_get_inbound_sms.py @@ -97,15 +97,16 @@ def test_get_next_inbound_sms_will_get_correct_inbound_sms_list(client, sample_s _external=True) == json_response['links']['next'] -def test_get_next_inbound_sms_at_end_will_return_empty_inbound_sms_list(client, sample_inbound_sms, mocker): +def test_get_next_inbound_sms_at_end_will_return_empty_inbound_sms_list(client, sample_service, mocker): + inbound_sms = create_inbound_sms(service=sample_service) mocker.patch.dict( "app.v2.inbound_sms.get_inbound_sms.current_app.config", {"API_PAGE_SIZE": 1} ) - auth_header = create_authorization_header(service_id=sample_inbound_sms.service.id) + auth_header = create_authorization_header(service_id=inbound_sms.service.id) response = client.get( - path=url_for('v2_inbound_sms.get_inbound_sms', older_than=sample_inbound_sms.id), + path=url_for('v2_inbound_sms.get_inbound_sms', older_than=inbound_sms.id), headers=[('Content-Type', 'application/json'), auth_header]) assert response.status_code == 200