Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_echo():
robot = werobot.WeRoBot(token=werobot.utils.generate_token())
@robot.handler
def echo(message):
return message.img
tester = werobot.testing.WeTest(robot)
xml = """
1348831860
1234567890123456
def test_echo():
robot = werobot.WeRoBot(token=werobot.utils.generate_token())
@robot.handler
def echo(message):
return message.content
tester = werobot.test.WeTest(robot)
message = werobot.test.make_text_message('test')
print tester.send(message)
assert tester.send(message) == 'test'
def test_echo():
robot = werobot.WeRoBot(token=werobot.utils.generate_token())
@robot.handler
def echo(message):
return message.content
tester = werobot.testing.WeTest(robot)
xml = """
1348831860
<content></content>
1234567890123456
"""
def test_echo():
robot = werobot.WeRoBot(token=werobot.utils.generate_token())
@robot.location
def report(message):
x, y = message.location
return 'You are at ({x}, {y})'.format(
x=x,
y=y
)
tester = werobot.testing.WeTest(robot)
xml = """
1351776360
def test_two():
robot = werobot.WeRoBot(token=werobot.utils.generate_token())
@robot.handler
def first(message):
if 'hi' in message.content:
return 'Hello'
@robot.handler
def second(message):
return "Hi"
tester = werobot.testing.WeTest(robot)
xml = """
1348831860
def test_types():
robot = werobot.WeRoBot(token=werobot.utils.generate_token())
for type in robot.message_types:
assert hasattr(robot, type)
@robot.text
def second(message):
return "Hi"
@robot.image
def third(message):
return 'nice pic'
tester = werobot.testing.WeTest(robot)
xml = """
def test_link():
robot = werobot.WeRoBot(token=werobot.utils.generate_token())
@robot.link
def first(message):
assert message.title == 'title'
assert message.description == 'description'
assert message.url == 'url'
tester = werobot.testing.WeTest(robot)
xml = """
123456789
<title><![CDATA[title]]></title>
def test_session():
robot = werobot.WeRoBot(
token=werobot.utils.generate_token(), enable_session=True
)
@robot.text
def first(message, session):
if 'last' in session:
return
session['last'] = message.content
return message.content
@robot.text
def second(_, session):
return session['last']
tester = werobot.testing.WeTest(robot)
xml_1 = """
def test_events():
robot = werobot.WeRoBot(token=werobot.utils.generate_token())
t = [False, '', 'NOTCHANGED']
@robot.subscribe
def first(message):
return 'Hi'
tester = werobot.testing.WeTest(robot)
xml = """
123456789