Implement TO start_date and end_date
This commit is contained in:
parent
898f63a2f5
commit
7b8ccbf145
@ -70,15 +70,11 @@ class TaskOrder(Base, mixins.TimestampsMixin):
|
||||
|
||||
@property
|
||||
def start_date(self):
|
||||
# TODO: fix task order -- reimplement using CLINs
|
||||
# Faked for display purposes
|
||||
return date.today()
|
||||
return min(c.start_date for c in self.clins)
|
||||
|
||||
@property
|
||||
def end_date(self):
|
||||
# TODO: fix task order -- reimplement using CLINs
|
||||
# Faked for display purposes
|
||||
return date.today()
|
||||
return max(c.end_date for c in self.clins)
|
||||
|
||||
@property
|
||||
def days_to_expiration(self):
|
||||
|
@ -293,7 +293,7 @@ class CLINFactory(Base):
|
||||
start_date = datetime.date.today()
|
||||
end_date = factory.LazyFunction(random_future_date)
|
||||
obligated_amount = random.randint(100, 999999)
|
||||
jedi_clin_type = random.choice([e for e in clin.JEDICLINType])
|
||||
jedi_clin_type = random.choice(list(clin.JEDICLINType))
|
||||
|
||||
|
||||
class NotificationRecipientFactory(Base):
|
||||
|
@ -1,5 +1,6 @@
|
||||
from werkzeug.datastructures import FileStorage
|
||||
import pytest, datetime
|
||||
import pytest
|
||||
from datetime import date
|
||||
|
||||
from atst.models import *
|
||||
from atst.models.clin import JEDICLINType
|
||||
@ -14,6 +15,38 @@ from tests.factories import (
|
||||
from tests.mocks import PDF_FILENAME
|
||||
|
||||
|
||||
class TestPeriodOfPerformance:
|
||||
def test_period_of_performance_is_first_to_last_clin(self):
|
||||
start_date = date(2019, 6, 6)
|
||||
end_date = date(2020, 6, 6)
|
||||
|
||||
intermediate_start_date = date(2019, 7, 1)
|
||||
intermediate_end_date = date(2020, 3, 1)
|
||||
|
||||
task_order = TaskOrderFactory.create(
|
||||
clins=[
|
||||
CLINFactory.create(
|
||||
start_date=intermediate_start_date, end_date=intermediate_end_date
|
||||
),
|
||||
CLINFactory.create(
|
||||
start_date=start_date, end_date=intermediate_end_date
|
||||
),
|
||||
CLINFactory.create(
|
||||
start_date=intermediate_start_date, end_date=intermediate_end_date
|
||||
),
|
||||
CLINFactory.create(
|
||||
start_date=intermediate_start_date, end_date=end_date
|
||||
),
|
||||
CLINFactory.create(
|
||||
start_date=intermediate_start_date, end_date=intermediate_end_date
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
assert task_order.start_date == start_date
|
||||
assert task_order.end_date == end_date
|
||||
|
||||
|
||||
class TestTaskOrderStatus:
|
||||
@pytest.mark.skip(reason="Reimplement after adding CLINs")
|
||||
def test_started_status(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user