Skip to content

Commit

Permalink
Move tests out of try as this was masking an error
Browse files Browse the repository at this point in the history
  • Loading branch information
iranzo committed Jun 15, 2017
1 parent 7225894 commit c82c9f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions stampy/plugin/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ def doforward(message, target):
code = False
attempt = 0
exitcode = 0

logger.debug(msg=_L("forwarding message: Code: %s : Text: %s") % (code, text))

while not code:
# It this is executed as per unit testing, skip sending message
UTdisable = not stampy.plugin.config.config(key='unittest', default=False)
Expand Down Expand Up @@ -116,7 +119,6 @@ def doforward(message, target):
if attempt > 60:
logger.error(msg=_L("PERM ERROR forwarding message: Code: %s : Text: %s") % (code, result))
code = True
logger.debug(msg=_L("forwarding message: Code: %s : Text: %s") % (code, text))
return exitcode


Expand Down Expand Up @@ -290,5 +292,5 @@ def getforward(source):
cur = stampy.stampy.dbsql(sql)
rows = cur.fetchall()
for target in rows:
logger.debug(msg=_L("getforward: %s -> %s" % (source, target)))
logger.debug(msg=_L("getforward: %s -> %s" % (source, target[0])))
yield target[0]
7 changes: 4 additions & 3 deletions stampy/stampy.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,11 @@ def sendimage(chat_id=0, image="", text="", reply_to_message_id=""):
# Send image
files = {'photo': rawimage.raw}

# It this is executed as per unit testing, skip sending message
UTdisable = not plugin.config.config(key='unittest', default=False)
Silent = not plugin.config.gconfig(key='silent', default=False, gid=geteffectivegid(gid=chat_id))

try:
# It this is executed as per unit testing, skip sending message
UTdisable = not plugin.config.config(key='unittest', default=False)
Silent = not plugin.config.gconfig(key='silent', default=False, gid=geteffectivegid(gid=chat_id))
if UTdisable and Silent:
output = requests.post(url, files=files, data=payload)
sent = {"message": json.loads(output.text)['result']}
Expand Down

0 comments on commit c82c9f3

Please sign in to comment.