Exemplo n.º 1
0
 def test_watched_up_to_with_sync(self):
     with BangumiSession('*****@*****.**', '15263748') as session:
         sub_coll = session.get_sub_collection("265")
         self.set_up_sub_coll(sub_coll)
         if sub_coll.sync_collection() and sub_coll.sync_n_watched_eps():
             sub_coll.ep_collections[0].c_status = 'queue'
             sub_coll.ep_collections[0].sync_collection()
             sub_coll.ep_collections[1].remove_with_sync()
         else:
             self.fail()
          
         self.assertEqual('queue', sub_coll.ep_collections[0].c_status)
         self.assertEqual(None, sub_coll.ep_collections[1].c_status)
         with self.assertRaises(ValueError):
             ep_id = "519"
             ep_coll = BangumiEpisodeCollection.from_html(ep_id,
                                                          self._ep_html)
             sub_coll.watched_up_to_with_sync(ep_coll)
         with self.assertRaises(ValueError):
             sub_coll.watched_up_to_with_sync("SP10")
         with self.assertRaises(TypeError):
             sub_coll.watched_up_to_with_sync(sub_coll)
              
         sub_coll.watched_up_to_with_sync("EP2")
         for i in range(2):
             self.assertEqual('watched',
                              sub_coll.ep_collections[i].c_status)
Exemplo n.º 2
0
 def test_c_status(self):
     ep_id = "519"
     ep_coll = BangumiEpisodeCollection.from_html(ep_id, self._ep_html)
     with self.assertRaises(ValueError):
         ep_coll.c_status = 'invalid'
     self.assertEqual('watched', ep_coll.c_status)
     ep_coll.c_status = 'drop'
     self.assertEqual('drop', ep_coll.c_status)
Exemplo n.º 3
0
 def test_sub_collection(self):
     ep_id = "519"
     ep_coll = BangumiEpisodeCollection.from_html(ep_id, self._ep_html)
     self.assertIsNone(ep_coll.sub_collection)
     with self.assertRaises(TypeError):
         ep_coll.sub_collection = ep_coll
Exemplo n.º 4
0
 def test_from_to_json(self):
     ep_id = "519"
     ep_coll = BangumiEpisodeCollection.from_html(ep_id, self._ep_html)
     json_text = ep_coll.to_json()
     ep_coll_new = BangumiEpisodeCollection.from_json(json_text)
     self.assertEqual(ep_coll, ep_coll_new)
Exemplo n.º 5
0
 def test_from_html_with_ep(self):
     ep_id = "519"
     ep = BangumiEpisode.from_html(ep_id, self._ep_html)
     ep_coll = BangumiEpisodeCollection.from_html_with_ep(ep,
                                                          self._ep_html)
     self.assertEqual(self._c_statuses[0], ep_coll.c_status)