mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-11 09:27:56 -04:00
Tests being configured.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
This commit is contained in:
@@ -448,11 +448,13 @@ class Organization(db.Model):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def agreement_active(self):
|
def agreement_active(self):
|
||||||
return self.agreement and self.agreement.status == AgreementStatus.active
|
return (
|
||||||
|
self.agreement.status == AgreementStatus.active if self.agreement else False
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def has_mou(self):
|
def has_mou(self):
|
||||||
return self.agreement and self.agreement.type == AgreementType.MOU
|
return self.agreement.type == AgreementType.MOU if self.agreement else False
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ def test_should_not_delete_invitations_less_than_two_days_old(
|
|||||||
make_invitation(
|
make_invitation(
|
||||||
sample_user,
|
sample_user,
|
||||||
sample_service,
|
sample_service,
|
||||||
age=two_days - one_second, # Not quite two days
|
age=two_days - one_second, # Not quite two days
|
||||||
email_address="valid@2.com",
|
email_address="valid@2.com",
|
||||||
)
|
)
|
||||||
make_invitation(
|
make_invitation(
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ from app.models import (
|
|||||||
NOTIFICATION_TECHNICAL_FAILURE,
|
NOTIFICATION_TECHNICAL_FAILURE,
|
||||||
SMS_TYPE,
|
SMS_TYPE,
|
||||||
Agreement,
|
Agreement,
|
||||||
|
AgreementStatus,
|
||||||
|
AgreementType,
|
||||||
AnnualBilling,
|
AnnualBilling,
|
||||||
Notification,
|
Notification,
|
||||||
NotificationHistory,
|
NotificationHistory,
|
||||||
@@ -28,6 +30,7 @@ from app.models import (
|
|||||||
from tests.app.db import (
|
from tests.app.db import (
|
||||||
create_inbound_number,
|
create_inbound_number,
|
||||||
create_notification,
|
create_notification,
|
||||||
|
create_organization,
|
||||||
create_rate,
|
create_rate,
|
||||||
create_reply_to_email,
|
create_reply_to_email,
|
||||||
create_service,
|
create_service,
|
||||||
@@ -412,6 +415,46 @@ def test_rate_str():
|
|||||||
assert rate.__str__() == "1.5 sms 2023-01-01 00:00:00"
|
assert rate.__str__() == "1.5 sms 2023-01-01 00:00:00"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
["agreement_type", "expected"],
|
||||||
|
(
|
||||||
|
(AgreementType.IAA, False),
|
||||||
|
(AgreementType.MOU, True),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
def test_organization_agreement_mou(notify_db_session, agreement_type, expected):
|
||||||
|
now = datetime.utcnow()
|
||||||
|
agree = Agreement()
|
||||||
|
agree.id = "whatever"
|
||||||
|
agree.start_time = now
|
||||||
|
agree.end_time = now
|
||||||
|
agree.status = AgreementStatus.ACTIVE
|
||||||
|
agree.type = agreement_type
|
||||||
|
organization = create_organization(name="Something")
|
||||||
|
organization.agreements.append(agree)
|
||||||
|
assert organization.has_mou == expected
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
["agreement_status", "expected"],
|
||||||
|
(
|
||||||
|
(AgreementStatus.EXPIRED, False),
|
||||||
|
(AgreementStatus.ACTIVE, True),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
def test_organization_agreement_active(notify_db_session, agreement_status, expected):
|
||||||
|
now = datetime.utcnow()
|
||||||
|
agree = Agreement()
|
||||||
|
agree.id = "whatever"
|
||||||
|
agree.start_time = now
|
||||||
|
agree.end_time = now
|
||||||
|
agree.status = agreement_status
|
||||||
|
agree.type = AgreementType.IAA
|
||||||
|
organization = create_organization(name="Something")
|
||||||
|
organization.agreements.append(agree)
|
||||||
|
assert organization.active == expected
|
||||||
|
|
||||||
|
|
||||||
def test_agreement_serialize():
|
def test_agreement_serialize():
|
||||||
agree = Agreement()
|
agree = Agreement()
|
||||||
agree.id = "abc"
|
agree.id = "abc"
|
||||||
|
|||||||
Reference in New Issue
Block a user