import werobot
import werobot.utils
import werobot.testing


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(message, session):
        return session['last']

    tester = werobot.testing.WeTest(robot)
    message_1 = werobot.testing.make_text_message('ss')
    message_2 = werobot.testing.make_text_message('dd')
    assert tester.send(message_1) == tester.send(message_2) == 'ss'

@@ -1,20 +1,56 @@
+# -*- coding: utf-8 -*-%0A%0Aimport os%0A%0A
 import werobot%0Aimpor
@@ -98,23 +98,152 @@
 def 
-test_session():
+remove_file_session():%0A    try:%0A        os.remove(%22werobot_session.db%22)%0A    except:%0A        pass%0A%0A%0Adef test_session():%0A    remove_file_session()
 %0A   

remove session file before testing