Added test for go_live_user and go_live_at in the response for get_service_by_id

This commit is contained in:
Rebecca Law
2019-04-16 12:33:07 +01:00
parent 60b4970d7f
commit 55a65a22a9
4 changed files with 15 additions and 4 deletions

View File

@@ -93,7 +93,9 @@ def create_service(
prefix_sms=True,
message_limit=1000,
organisation_type='central',
check_if_service_exists=False
check_if_service_exists=False,
go_live_user=None,
go_live_at=None
):
if check_if_service_exists:
service = Service.query.filter_by(name=service_name).first()
@@ -105,7 +107,9 @@ def create_service(
email_from=email_from if email_from else service_name.lower().replace(' ', '.'),
created_by=user if user else create_user(email='{}@digital.cabinet-office.gov.uk'.format(uuid.uuid4())),
prefix_sms=prefix_sms,
organisation_type=organisation_type
organisation_type=organisation_type,
go_live_user=go_live_user,
go_live_at=go_live_at
)
dao_create_service(service, service.created_by, service_id, service_permissions=service_permissions)

View File

@@ -221,6 +221,14 @@ def test_get_service_by_id_should_404_if_no_service_for_user(notify_api, sample_
assert json_resp['message'] == 'No result found'
def test_get_service_by_id_returns_go_live_user_and_go_live_at(admin_request, sample_user):
now = datetime.utcnow()
service = create_service(user=sample_user, go_live_user=sample_user, go_live_at=now)
json_resp = admin_request.get('service.get_service_by_id', service_id=service.id)
assert json_resp['data']['go_live_user'] == str(sample_user.id)
assert json_resp['data']['go_live_at'] == str(now)
@pytest.mark.parametrize('platform_admin, expected_count_as_live', (
(True, False),
(False, True),