mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 02:11:11 -05:00
Query to return the inbound api data for the service
This commit is contained in:
@@ -30,3 +30,7 @@ def reset_service_inbound_api(service_inbound_api, updated_by_id, url=None, bear
|
|||||||
def get_service_inbound_api(service_inbound_api_id, service_id):
|
def get_service_inbound_api(service_inbound_api_id, service_id):
|
||||||
return ServiceInboundApi.query.filter_by(id=service_inbound_api_id,
|
return ServiceInboundApi.query.filter_by(id=service_inbound_api_id,
|
||||||
service_id=service_id).first()
|
service_id=service_id).first()
|
||||||
|
|
||||||
|
|
||||||
|
def get_service_inbound_api_for_service(service_id):
|
||||||
|
return ServiceInboundApi.query.filter_by(service_id=service_id).first()
|
||||||
|
|||||||
@@ -591,3 +591,9 @@ def handle_sql_errror(e):
|
|||||||
return jsonify(result='error', message="No result found"), 404
|
return jsonify(result='error', message="No result found"), 404
|
||||||
else:
|
else:
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|
||||||
|
@service_blueprint.route('/<uuid:service_id>/inbound-sms', methods=["POST"])
|
||||||
|
def push_inbound_sms_to_service(service_id):
|
||||||
|
|
||||||
|
pass
|
||||||
|
|||||||
@@ -7,9 +7,10 @@ from app import encryption
|
|||||||
from app.dao.service_inbound_api_dao import (
|
from app.dao.service_inbound_api_dao import (
|
||||||
save_service_inbound_api,
|
save_service_inbound_api,
|
||||||
reset_service_inbound_api,
|
reset_service_inbound_api,
|
||||||
get_service_inbound_api
|
get_service_inbound_api,
|
||||||
)
|
get_service_inbound_api_for_service)
|
||||||
from app.models import ServiceInboundApi
|
from app.models import ServiceInboundApi
|
||||||
|
from tests.app.db import create_service_inbound_api
|
||||||
|
|
||||||
|
|
||||||
def test_save_service_inbound_api(sample_service):
|
def test_save_service_inbound_api(sample_service):
|
||||||
@@ -115,3 +116,14 @@ def test_get_service_inbound_api(sample_service):
|
|||||||
assert inbound_api.bearer_token == "some_unique_string"
|
assert inbound_api.bearer_token == "some_unique_string"
|
||||||
assert inbound_api._bearer_token != "some_unique_string"
|
assert inbound_api._bearer_token != "some_unique_string"
|
||||||
assert inbound_api.updated_at is None
|
assert inbound_api.updated_at is None
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_service_inbound_api_for_service(sample_service):
|
||||||
|
service_inbound_api = create_service_inbound_api(service=sample_service)
|
||||||
|
result = get_service_inbound_api_for_service(sample_service.id)
|
||||||
|
assert result.id == service_inbound_api.id
|
||||||
|
assert result.url == service_inbound_api.url
|
||||||
|
assert result.bearer_token == service_inbound_api.bearer_token
|
||||||
|
assert result.created_at == service_inbound_api.created_at
|
||||||
|
assert result.updated_at == service_inbound_api.updated_at
|
||||||
|
assert result.updated_by_id == service_inbound_api.updated_by_id
|
||||||
|
|||||||
Reference in New Issue
Block a user