@@ -345,12 +345,13 @@ class RTClient:
self.user = http_auth.username
self.password = http_auth.password
self.auth_method = type(http_auth).__name__
self.login_result = True
self.last_login = None
self.want_cfs = want_cfs
self.edits = {}
def login(self, login=None, password=None):
if login is None and password is None:
login = self.user
password = self.password
self.login_result = bool(login and password and not password.startswith('bad'))
@@ -399,16 +400,21 @@ class RTClient:
'Requestors': [
f'mx{ticket_id_s}@example.org',
'requestor2@example.org',
],
}
if self.want_cfs:
retval['CF.{payment-method}'] = f'payment method {ticket_id_s}'
retval['CF.{payment-amount}'] = ''
retval['CF.{payment-method}'] = ''
retval['CF.{payment-to}'] = f'Hon. Mx. {ticket_id_s}'
return retval
def edit_ticket(self, ticket_id, **kwargs):
self.edits.setdefault(str(ticket_id), {}).update(kwargs)
return True
def get_user(self, user_id):
user_id_s = str(user_id)
match = re.search(r'(\d+)@', user_id_s)
if match is None:
email = f'mx{user_id_s}@example.org'
user_id_num = int(user_id_s)