mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 10:21:14 -05:00
Got tests to use OrganizationType everywhere now.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
This commit is contained in:
@@ -11,6 +11,7 @@ from app.dao.organization_dao import (
|
||||
dao_add_user_to_organization,
|
||||
)
|
||||
from app.dao.services_dao import dao_archive_service
|
||||
from app.enums import OrganizationType
|
||||
from app.models import AnnualBilling, Organization
|
||||
from tests.app.db import (
|
||||
create_annual_billing,
|
||||
@@ -25,7 +26,7 @@ from tests.app.db import (
|
||||
|
||||
|
||||
def test_get_all_organizations(admin_request, notify_db_session):
|
||||
create_organization(name="inactive org", active=False, organization_type="federal")
|
||||
create_organization(name="inactive org", active=False, organization_type=OrganizationType.FEDERAL)
|
||||
create_organization(name="active org", domains=["example.com"])
|
||||
|
||||
response = admin_request.get("organization.get_organizations", _expected_status=200)
|
||||
@@ -52,7 +53,7 @@ def test_get_all_organizations(admin_request, notify_db_session):
|
||||
assert response[1]["active"] is False
|
||||
assert response[1]["count_of_live_services"] == 0
|
||||
assert response[1]["domains"] == []
|
||||
assert response[1]["organization_type"] == "federal"
|
||||
assert response[1]["organization_type"] == OrganizationType.FEDERAL
|
||||
|
||||
|
||||
def test_get_organization_by_id(admin_request, notify_db_session):
|
||||
@@ -163,7 +164,7 @@ def test_post_create_organization(admin_request, notify_db_session):
|
||||
data = {
|
||||
"name": "test organization",
|
||||
"active": True,
|
||||
"organization_type": "state",
|
||||
"organization_type": OrganizationType.STATE,
|
||||
}
|
||||
|
||||
response = admin_request.post(
|
||||
@@ -213,7 +214,7 @@ def test_post_create_organization_existing_name_raises_400(
|
||||
data = {
|
||||
"name": sample_organization.name,
|
||||
"active": True,
|
||||
"organization_type": "federal",
|
||||
"organization_type": OrganizationType.FEDERAL,
|
||||
}
|
||||
|
||||
response = admin_request.post(
|
||||
@@ -233,7 +234,7 @@ def test_post_create_organization_works(admin_request, sample_organization):
|
||||
data = {
|
||||
"name": "org 2",
|
||||
"active": True,
|
||||
"organization_type": "federal",
|
||||
"organization_type": OrganizationType.FEDERAL,
|
||||
}
|
||||
|
||||
admin_request.post(
|
||||
@@ -251,7 +252,7 @@ def test_post_create_organization_works(admin_request, sample_organization):
|
||||
(
|
||||
{
|
||||
"active": False,
|
||||
"organization_type": "federal",
|
||||
"organization_type": OrganizationType.FEDERAL,
|
||||
},
|
||||
"name is a required property",
|
||||
),
|
||||
@@ -295,7 +296,7 @@ def test_post_update_organization_updates_fields(
|
||||
data = {
|
||||
"name": "new organization name",
|
||||
"active": False,
|
||||
"organization_type": "federal",
|
||||
"organization_type": OrganizationType.FEDERAL,
|
||||
}
|
||||
|
||||
admin_request.post(
|
||||
@@ -312,7 +313,7 @@ def test_post_update_organization_updates_fields(
|
||||
assert organization[0].name == data["name"]
|
||||
assert organization[0].active == data["active"]
|
||||
assert organization[0].domains == []
|
||||
assert organization[0].organization_type == "federal"
|
||||
assert organization[0].organization_type == OrganizationType.FEDERAL
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@@ -568,7 +569,7 @@ def test_post_update_organization_set_mou_emails_signed_by(
|
||||
|
||||
def test_post_link_service_to_organization(admin_request, sample_service):
|
||||
data = {"service_id": str(sample_service.id)}
|
||||
organization = create_organization(organization_type="federal")
|
||||
organization = create_organization(organization_type=OrganizationType.FEDERAL)
|
||||
|
||||
admin_request.post(
|
||||
"organization.link_service_to_organization",
|
||||
@@ -585,7 +586,7 @@ def test_post_link_service_to_organization_inserts_annual_billing(
|
||||
admin_request, sample_service
|
||||
):
|
||||
data = {"service_id": str(sample_service.id)}
|
||||
organization = create_organization(organization_type="federal")
|
||||
organization = create_organization(organization_type=OrganizationType.FEDERAL)
|
||||
assert len(organization.services) == 0
|
||||
assert len(AnnualBilling.query.all()) == 0
|
||||
admin_request.post(
|
||||
@@ -610,7 +611,7 @@ def test_post_link_service_to_organization_rollback_service_if_annual_billing_up
|
||||
data = {"service_id": str(sample_service.id)}
|
||||
assert not sample_service.organization_type
|
||||
|
||||
organization = create_organization(organization_type="federal")
|
||||
organization = create_organization(organization_type=OrganizationType.FEDERAL)
|
||||
assert len(organization.services) == 0
|
||||
assert len(AnnualBilling.query.all()) == 0
|
||||
with pytest.raises(expected_exception=SQLAlchemyError):
|
||||
@@ -641,7 +642,7 @@ def test_post_link_service_to_another_org(
|
||||
assert len(sample_organization.services) == 1
|
||||
assert not sample_service.organization_type
|
||||
|
||||
new_org = create_organization(organization_type="federal")
|
||||
new_org = create_organization(organization_type=OrganizationType.FEDERAL)
|
||||
admin_request.post(
|
||||
"organization.link_service_to_organization",
|
||||
_data=data,
|
||||
@@ -650,7 +651,7 @@ def test_post_link_service_to_another_org(
|
||||
)
|
||||
assert not sample_organization.services
|
||||
assert len(new_org.services) == 1
|
||||
assert sample_service.organization_type == "federal"
|
||||
assert sample_service.organization_type == OrganizationType.FEDERAL
|
||||
annual_billing = AnnualBilling.query.all()
|
||||
assert len(annual_billing) == 1
|
||||
assert annual_billing[0].free_sms_fragment_limit == 150000
|
||||
|
||||
Reference in New Issue
Block a user