Ejemplo n.º 1
0
class SickBeardAPITestCase(TestCase):
    idShow = 2410

    def setUp(self):
        self.sickBeardAPI = SickBeardAPI("localhost:8081", "https", "0f82b885553028ed594211e0b2a6de4f")
        self.assertEqual(
            self.sickBeardAPI.builder.getUrl("", ""), "https://localhost:8081/api/0f82b885553028ed594211e0b2a6de4f"
        )

    def test_add_show(self):
        self.assertFalse(self.sickBeardAPI.add_show(0)[0])

    def test_del_show(self):
        self.assertFalse(self.sickBeardAPI.del_show(0)[0])

    def test_pause_show(self):
        self.assertFalse(self.sickBeardAPI.pause_show(0, 0)[0])
        self.assertFalse(self.sickBeardAPI.pause_show(0, 1)[0])
        self.assertFalse(self.sickBeardAPI.pause_show(0, 50)[0])

    def test_workflow(self):
        showId = 268906
        self.assertTrue(self.sickBeardAPI.add_show(showId)[0])
        # need to sleep, otherwise, the show is not added.
        time.sleep(5)
        self.assertTrue(self.sickBeardAPI.pause_show(showId, 1)[0])
        self.assertTrue(self.sickBeardAPI.pause_show(showId, 1)[0])
        self.assertTrue(self.sickBeardAPI.pause_show(showId, 0)[0])
        self.assertTrue(self.sickBeardAPI.pause_show(showId, 0)[0])

        self.assertFalse(self.sickBeardAPI.del_show(showId)[0])
        self.assertEqual(self.sickBeardAPI.del_show(showId)[1], "Show can not be deleted while being added or updated")
        time.sleep(10)
        self.assertTrue(self.sickBeardAPI.del_show(showId)[0])
        self.assertFalse(self.sickBeardAPI.pause_show(showId, 1)[0])

    def suite(self):
        suite = TestSuite()
        suite.addTest(TestLoader().loadTestsFromTestCase(SickBeardAPITestCase))
        return suite

    if __name__ == "__main__":
        TextTestRunner().run(suite())
Ejemplo n.º 2
0
                    tvdbid, title = beta.shows_tvdbid(betaid)
                    logger.info("[BetaBeard] Delete Show from sickbeard :  %s (%s)", title, tvdbid)

                    if (param['demoMode'] == False):
                        success, message =  sickBeard.del_show(tvdbid)
                        if (success == False):
                            logger.error("[BetaBeard] Can't delete show %s (%s) from sickbeard : %s.", title, tvdbid, message)

                # - PAUSE SERIE - #
                elif (event['type'] == 'archive'):
                    betaid = str(event['ref_id']);
                    tvdbid, title = beta.shows_tvdbid(betaid)
                    logger.info("[BetaBeard] Archive Show on sickbeard : %s (%s)", title, tvdbid)

                    if (param['demoMode'] == False):
                        success, message =  sickBeard.pause_show(tvdbid, 1)
                        if (success == False):
                            logger.error("[BetaBeard] Can't pause show %s (%s) on sickbeard : %s.", title, tvdbid, message)

                # - UNPAUSE SERIE - #
                elif (event['type'] == 'unarchive'):
                    betaid = str(event['ref_id']);
                    tvdbid, title = beta.shows_tvdbid(betaid)
                    logger.info("[BetaBeard] UnArchive Show on sickbeard :  %s (%s)", title, tvdbid)

                    if (param['demoMode'] == False):
                        success, message =  sickBeard.pause_show(tvdbid, 0)
                        if (success == False):
                            logger.error("[BetaBeard] Can't unpause show %s (%s) on sickbeard : %s.", title, tvdbid, message)

        logger.info("[BetaBeard] Timeline processing done.")