DD-254 domain class and method for checking if DD-254 is complete
This commit is contained in:
parent
bfcee47db6
commit
ad05c448cd
@ -4,6 +4,7 @@ from flask import current_app as app
|
|||||||
from atst.database import db
|
from atst.database import db
|
||||||
from atst.models.task_order import TaskOrder
|
from atst.models.task_order import TaskOrder
|
||||||
from atst.models.permissions import Permissions
|
from atst.models.permissions import Permissions
|
||||||
|
from atst.models.dd_254 import DD254
|
||||||
from atst.domain.portfolios import Portfolios
|
from atst.domain.portfolios import Portfolios
|
||||||
from atst.domain.authz import Authorization
|
from atst.domain.authz import Authorization
|
||||||
from .exceptions import NotFoundError
|
from .exceptions import NotFoundError
|
||||||
@ -171,3 +172,15 @@ class TaskOrders(object):
|
|||||||
raise TaskOrderError(
|
raise TaskOrderError(
|
||||||
"{} is not an officer role on task orders".format(officer_type)
|
"{} is not an officer role on task orders".format(officer_type)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class DD254s:
|
||||||
|
# TODO: standin implementation until we have a real download,
|
||||||
|
# sign, and verify process for the DD 254 PDF
|
||||||
|
@classmethod
|
||||||
|
def complete(cls, dd254):
|
||||||
|
for col in DD254.__table__.columns:
|
||||||
|
if getattr(dd254, col.name) is None:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
@ -213,3 +213,12 @@ TEAM_EXPERIENCE = [
|
|||||||
PERIOD_OF_PERFORMANCE_LENGTH = [
|
PERIOD_OF_PERFORMANCE_LENGTH = [
|
||||||
(str(x + 1), translate_duration(x + 1)) for x in range(24)
|
(str(x + 1), translate_duration(x + 1)) for x in range(24)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
REQUIRED_DISTRIBUTIONS = [
|
||||||
|
("contractor", "Contractor"),
|
||||||
|
("subcontractor", "Subcontractor"),
|
||||||
|
("cognizant_so", "Cognizant Security Office for Prime and Subcontractor"),
|
||||||
|
("overseas", "U.S. Activity Responsible for Overseas Security Administration"),
|
||||||
|
("administrative_ko", "Administrative Contracting Officer"),
|
||||||
|
("other", "Other as necessary"),
|
||||||
|
]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from atst.domain.task_orders import TaskOrders, TaskOrderError
|
from atst.domain.task_orders import TaskOrders, TaskOrderError, DD254s
|
||||||
from atst.domain.exceptions import UnauthorizedError
|
from atst.domain.exceptions import UnauthorizedError
|
||||||
from atst.models.attachment import Attachment
|
from atst.models.attachment import Attachment
|
||||||
|
|
||||||
@ -9,6 +9,7 @@ from tests.factories import (
|
|||||||
UserFactory,
|
UserFactory,
|
||||||
PortfolioRoleFactory,
|
PortfolioRoleFactory,
|
||||||
PortfolioFactory,
|
PortfolioFactory,
|
||||||
|
DD254Factory,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -113,3 +114,11 @@ def test_task_order_access():
|
|||||||
"add_officer",
|
"add_officer",
|
||||||
[task_order, "contracting_officer", rando.to_dictionary()],
|
[task_order, "contracting_officer", rando.to_dictionary()],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_dd254_complete():
|
||||||
|
finished = DD254Factory.create()
|
||||||
|
unfinished = DD254Factory.create(certifying_official=None)
|
||||||
|
|
||||||
|
assert DD254s.complete(finished)
|
||||||
|
assert not DD254s.complete(unfinished)
|
||||||
|
@ -24,6 +24,7 @@ from atst.domain.roles import Roles, PORTFOLIO_ROLES
|
|||||||
from atst.models.portfolio_role import PortfolioRole, Status as PortfolioRoleStatus
|
from atst.models.portfolio_role import PortfolioRole, Status as PortfolioRoleStatus
|
||||||
from atst.models.environment_role import EnvironmentRole
|
from atst.models.environment_role import EnvironmentRole
|
||||||
from atst.models.invitation import Invitation, Status as InvitationStatus
|
from atst.models.invitation import Invitation, Status as InvitationStatus
|
||||||
|
from atst.models.dd_254 import DD254
|
||||||
from atst.domain.invitations import Invitations
|
from atst.domain.invitations import Invitations
|
||||||
|
|
||||||
|
|
||||||
@ -427,3 +428,16 @@ class TaskOrderFactory(Base):
|
|||||||
so_email = factory.Faker("email")
|
so_email = factory.Faker("email")
|
||||||
so_phone_number = factory.LazyFunction(random_phone_number)
|
so_phone_number = factory.LazyFunction(random_phone_number)
|
||||||
so_dod_id = factory.LazyFunction(random_dod_id)
|
so_dod_id = factory.LazyFunction(random_dod_id)
|
||||||
|
|
||||||
|
|
||||||
|
class DD254Factory(Base):
|
||||||
|
class Meta:
|
||||||
|
model = DD254
|
||||||
|
|
||||||
|
certifying_official = factory.Faker("name")
|
||||||
|
co_title = factory.Faker("job")
|
||||||
|
co_address = factory.Faker("address")
|
||||||
|
co_phone = factory.LazyFunction(random_phone_number)
|
||||||
|
required_distribution = factory.LazyFunction(
|
||||||
|
lambda: [random_choice(data.REQUIRED_DISTRIBUTIONS)]
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user