Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexAndrei98 committed Jul 20, 2023
1 parent 01b0845 commit 443e139
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/keria/app/agenting.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def __init__(self, name, bran, base="", configFile=None, configDir=None, adb=Non
self.cf = None
self.intercepts = decking.Deck()
doers = []
self.interceptor = None
if interceptor_webhook is not None:
self.interceptor = InterceptorDoer(interceptor_webhook, interceptor_headers, cues=self.intercepts)
doers.append(self.interceptor)
Expand Down Expand Up @@ -415,7 +416,7 @@ def recur(self, tyme=None):

class Witnesser(doing.Doer):

def __init__(self, receiptor, witners, intercepts):
def __init__(self, receiptor, witners, intercepts=None):
self.receiptor = receiptor
self.witners = witners
self.intercepts = intercepts
Expand All @@ -426,22 +427,24 @@ def recur(self, tyme=None):
if self.witners:
msg = self.witners.popleft()
serder = msg["serder"]
self.intercepts.append(dict(evt="witnessed", ked=serder.ked))
if self.intercepts is not None:
self.intercepts.append(dict(evt="witnessed", ked=serder.ked))
# If we are a rotation event, may need to catch new witnesses up to current key state
if serder.ked['t'] in (Ilks.rot, Ilks.drt):
adds = serder.ked["ba"]
for wit in adds:
yield from self.receiptor.catchup(serder.pre, wit)

yield from self.receiptor.receipt(serder.pre, serder.sn)
self.intercepts.append(dict(evt="witnessing", data=dict(aid=serder.pre)))
if self.intercepts is not None:
self.intercepts.append(dict(evt="witnessing", data=dict(aid=serder.pre)))

yield self.tock


class Delegator(doing.Doer):

def __init__(self, agentHab, swain, anchors, intercepts):
def __init__(self, agentHab, swain, anchors, intercepts=None):
self.agentHab = agentHab
self.swain = swain
self.anchors = anchors
Expand All @@ -451,10 +454,10 @@ def __init__(self, agentHab, swain, anchors, intercepts):
def recur(self, tyme=None):
if self.anchors:
msg = self.anchors.popleft()

sn = msg["sn"] if "sn" in msg else None
self.swain.delegation(pre=msg["pre"], sn=sn, proxy=self.agentHab)
self.intercepts.append(dict(msg))
if self.intercepts is not None:
self.intercepts.append(dict(msg))

return False

Expand Down

0 comments on commit 443e139

Please sign in to comment.