Use pendulum to traverse mock reporting dates
Previously, subtracting 29 days could result in the same month listed twice (for example, subtracting 29 days from Nov 30, would result in two Novembers listed).
This commit is contained in:
parent
9d97a45a8d
commit
4081fa04e7
@ -1,4 +1,3 @@
|
||||
import datetime
|
||||
from itertools import groupby
|
||||
from collections import OrderedDict
|
||||
import pendulum
|
||||
@ -33,10 +32,10 @@ class MockApplication:
|
||||
|
||||
|
||||
def generate_sample_dates(_max=8):
|
||||
current = datetime.datetime.today()
|
||||
current = pendulum.now()
|
||||
sample_dates = []
|
||||
for _i in range(_max):
|
||||
current = current - datetime.timedelta(days=29)
|
||||
current = current.subtract(months=1)
|
||||
sample_dates.append(current.strftime("%m/%Y"))
|
||||
|
||||
reversed(sample_dates)
|
||||
|
@ -88,4 +88,4 @@ def test_portfolio_reports_with_mock_portfolio(client, user_session):
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert portfolio.name in response.data.decode()
|
||||
assert "$237,617.00 Total spend to date" in response.data.decode()
|
||||
assert "$251,626.00 Total spend to date" in response.data.decode()
|
||||
|
Loading…
x
Reference in New Issue
Block a user