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())
loadDb(configDb) if checkConfig(config) == False: sys.exit(0) # ----------- Init BetaSeries ----------- # try: beta = BetaSerieAPI(param['login'], param['password']) except BadLoginException as ex: logger.error("[BetaBeard] can't log into BetaSeries.com : %s", ex.value) sys.exit(0) logger.info("[BetaBeard] Login successfull.") # ----------- Init SickBeard ----------- # sickBeard = SickBeardAPI(param['sburl'], param['scheme'], param['apikey']) # ----------- Test SickBeard ----------- # if (sickBeard.ping() == False): logger.error("[BetaBeard] Can't ping SickBeard on url : %s://%s with apikey = %s",param['scheme'], param['sburl'], param['apikey']) sys.exit(0) logger.info("[BetaBeard] Ping SickBeard successfull.") # ----------- If fullUpdate, we retrieve all the current show and add them to sickbear.----------- # if paramDb['last_event_id'] == None: logger.debug("[BetaBeard] last_index_id is None") if param['fullUpdate'] == True: shows = beta.show_list(); logger.debug("[BetaBeard] shows : %s", shows) logger.info("[BetaBeard] Start processing shows.") for show in shows:
def setUp(self): self.sickBeardAPI = SickBeardAPI("localhost:8081", "https", "0f82b885553028ed594211e0b2a6de4f") self.assertEqual( self.sickBeardAPI.builder.getUrl("", ""), "https://localhost:8081/api/0f82b885553028ed594211e0b2a6de4f" )