@@ -22,12 +22,13 @@ import odf.table
from decimal import Decimal
from pathlib import Path
from typing import Any, Optional, NamedTuple
from conservancy_beancount import books, data, rtutil
from conservancy_beancount.config import RTCredentials
EXTREME_FUTURE_DATE = datetime.date(datetime.MAXYEAR, 12, 30)
FUTURE_DATE = datetime.date.today() + datetime.timedelta(days=365 * 99)
FY_START_DATE = datetime.date(2020, 3, 1)
FY_MID_DATE = datetime.date(2020, 9, 1)
PAST_DATE = datetime.date(2000, 1, 1)
@@ -283,16 +284,19 @@ class TestConfig:
def payment_threshold(self):
return self._payment_threshold
def repository_path(self):
return self.repo_path
def rt_client(self):
def rt_credentials(self):
return RTCredentials('https://example.org/testrt', 'testuser', 'testpass')
def rt_client(self, credentials=None):
return self._rt_client
def rt_wrapper(self):
def rt_wrapper(self, credentials=None):
return self._rt_wrapper
def TestRepo(head_hexsha='abcd1234', dirty=False):
retval = unittest.mock.Mock(spec=git.Repo)
retval.is_dirty.return_value = dirty
@@ -414,15 +418,19 @@ class RTClient:
}
def get_ticket(self, ticket_id):
ticket_id_s = str(ticket_id)
if ticket_id_s not in self.TICKET_DATA:
return None
ticket_id_n = int(ticket_id)
retval = {
'id': 'ticket/{}'.format(ticket_id_s),
'numerical_id': ticket_id_s,
'Created': f'2016-12-15T14:{ticket_id_n:02d}:40Z',
'Due': f'2017-01-14T12:{ticket_id_n:02d}:00Z',
'Queue': 'general',
'Requestors': [
f'mx{ticket_id_s}@example.org',
'requestor2@example.org',
],
if self.want_cfs: