The 'Expected Values' column of the data model attributes specification found on google drive states that the Account domain object's closing_date attribute should take the following values:
Empty or String date of form YYYYMMDD
Currently it is set to only take the latter of the two options (the string date of form YYYYMMDD) and not Empty
Design
account_factory.py
Amend the __create_closing_date method in the AccountFactory class of account_factory.py to return either a date string as currently implemented, or the string "Empty". To save time consider deciding which to return before evaluating the date, eg:
def __create_closing_date(self, opening_date):
if random.getrandbits(1): # fastest way to flip a coin
return "Empty"
else:
from_year = int(opening_date[:4])
from_month = int(opening_date[4:6])
from_day = int(opening_date[6:])
return self.create_random_date(from_year=from_year,
from_month=from_month,
from_day=from_day).strftime('%Y%m%d')
account_test.py
The closing_date_valid method in account_test.py should be amended to check the new return value, possibly using a regex to check all cases like so:
Issue Description
The 'Expected Values' column of the data model attributes specification found on google drive states that the
Account
domain object'sclosing_date
attribute should take the following values:Empty or String date of form YYYYMMDD
Currently it is set to only take the latter of the two options (the string date of form YYYYMMDD) and not Empty
Design
account_factory.py
Amend the
__create_closing_date
method in theAccountFactory
class ofaccount_factory.py
to return either a date string as currently implemented, or the string "Empty". To save time consider deciding which to return before evaluating the date, eg:account_test.py
The
closing_date_valid
method inaccount_test.py
should be amended to check the new return value, possibly using a regex to check all cases like so:Documentation Changes
Amend
__create_closing_date
andclosing_date_valid
docstrings to account for new possible return valueTest Evidence
Newly written test should pass
Validation in Develop
Output from running
python src/app.py
should be as expected.