@@ -0,0 +1,2296 @@
+import freezegun%0Aimport unittest%0Afrom flexmock import flexmock%0A%0Aimport pony.tasks%0Afrom pony.pony import StandupPonyPlugin%0A%0A%0Aclass BaseTest(unittest.TestCase):%0A    def setUp(self):%0A        self.bot = StandupPonyPlugin(%0A            plugin_config=%7B%0A                'db_file': ''%0A            %7D%0A        )%0A        self.slack = flexmock()%0A%0A%0Aclass SendMessageTest(BaseTest):%0A    def test_execute(self):%0A        task = pony.tasks.SendMessage('_to', '_text', %5B1, 2, 3%5D)%0A%0A        (flexmock(self.slack)%0A         .should_receive('api_call')%0A         .with_args(%0A            'chat.postMessage',%0A            channel='_to',%0A            text='_text',%0A            attachments=%5B1, 2, 3%5D,%0A            as_user=True%0A        ))%0A%0A        task.execute(self.bot, self.slack)%0A%0A%0Aclass UpdateUserListTest(BaseTest):%0A    def test_execute(self):%0A        task = pony.tasks.UpdateUserList()%0A%0A        (flexmock(self.slack)%0A         .should_receive('api_call')%0A         .with_args('users.list')%0A         .and_return(dict(%0A            members=%5B%0A                %7B'user': '_id1', 'deleted': False%7D,%0A                %7B'user': '_id2', 'deleted': True%7D,%0A            %5D%0A        )))%0A%0A        task.execute(self.bot, self.slack)%0A        self.assertEqual(%0A            self.bot.storage.get('users'),%0A            %5B%7B'user': '_id1', 'deleted': False%7D%5D%0A        )%0A%0A%0Aclass UpdateIMListTest(BaseTest):%0A    def test_execute(self):%0A        task = pony.tasks.UpdateIMList()%0A%0A        (flexmock(self.slack)%0A         .should_receive('api_call')%0A         .with_args('im.list')%0A         .and_return(dict(%0A            ims=%5B%0A                %7B'id': '_id1', 'is_im': True, 'is_user_deleted': False%7D,%0A                %7B'id': '_id2', 'is_im': False, 'is_user_deleted': False%7D,%0A                %7B'id': '_id3', 'is_im': True, 'is_user_deleted': True%7D,%0A            %5D%0A        )))%0A%0A        task.execute(self.bot, self.slack)%0A        self.assertEqual(%0A            self.bot.storage.get('ims'),%0A            %5B%7B'id': '_id1', 'is_im': True, 'is_user_deleted': False%7D%5D%0A        )%0A%0A%0Aclass SyncDBTest(BaseTest):%0A    def test_execute(self):%0A        task = pony.tasks.SyncDB()%0A%0A        (flexmock(self.bot.storage)%0A         .should_receive('save')%0A         .once())%0A%0A        task.execute(self.bot, self.slack)%0A        self.assertIsInstance(self.bot.slow_queue.pop(), pony.tasks.SyncDB)%0A

send message, update user list, update im list, sync db.