123456789101112131415161718192021222324252627282930 |
- import unittest
- from feed import CheckFeed
- test_channel_id = 'UCY9z_LHm2NMRJbqKl2H3Kdw'
- class TestFeed(unittest.TestCase):
- def test_not_negative_ineger(self):
- with self.assertRaises(ValueError):
- CheckFeed(test_channel_id, -5)
- with self.assertRaises(ValueError):
- CheckFeed(test_channel_id, 0)
- with self.assertRaises(ValueError):
- CheckFeed(test_channel_id, '')
- def test_items_quantity(self):
- quantity = 7
- test_feed = CheckFeed(test_channel_id, quantity)
- self.assertEqual(len(test_feed.videos), quantity)
- def test_read_method_quantity(self):
- test_feed = CheckFeed(test_channel_id, 7)
- with self.assertRaises(ValueError):
- test_feed.read(-1)
- def test_nonvalid_channel_id(self):
- with self.assertRaises(ValueError):
- CheckFeed('')
|