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())
tvdbid, title = beta.shows_tvdbid(betaid) logger.info("[BetaBeard] Add Show to sickbeard : %s (%s)", title, tvdbid) if (param['demoMode'] == False): success,message = sickBeard.add_show(tvdbid, param['location'], param['lang'], param['flatten_folder'], param['status'], param['initial'], param['archive']) if (success == False): logger.error("[BetaBeard] Can't add show %s (%s) to sickbeard : %s.", title, tvdbid, message) # - DELETE SERIE - # elif (event['type'] == 'del_serie'): betaid = str(event['ref_id']); 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 - #