mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 15:46:07 -05:00
Update the organsition usage endpoint to use the new query.
This endpoint may need to change, but we'd like to see how this performs, so we'll test this with a real data set. Then come back to make sure the format is correct and check for missing tests for the endpoint,
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from datetime import datetime
|
||||
|
||||
import uuid
|
||||
|
||||
import pytest
|
||||
@@ -11,6 +13,8 @@ from tests.app.db import (
|
||||
create_organisation,
|
||||
create_service,
|
||||
create_user,
|
||||
create_template,
|
||||
create_ft_billing
|
||||
)
|
||||
|
||||
|
||||
@@ -737,3 +741,16 @@ def test_is_organisation_name_unique_returns_400_when_name_does_not_exist(admin_
|
||||
|
||||
assert response["message"][0]["org_id"] == ["Can't be empty"]
|
||||
assert response["message"][1]["name"] == ["Can't be empty"]
|
||||
|
||||
|
||||
def test_get_organisation_services_usage(admin_request, notify_db_session):
|
||||
org = create_organisation(name='Organisation without live services')
|
||||
service = create_service()
|
||||
template = create_template(service=service)
|
||||
dao_add_service_to_organisation(service=service, organisation_id=org.id)
|
||||
create_ft_billing(bst_date=datetime.utcnow().date(), template=template, billable_unit=19, notifications_sent=19)
|
||||
response = admin_request.get(
|
||||
'organisation.get_organisation_services_usage',
|
||||
organisation_id=org.id
|
||||
)
|
||||
assert len(response) == 1
|
||||
|
||||
Reference in New Issue
Block a user