Reject large number of WebRTC audio channels
[WebKit-https.git] / tests / test_channel.py
1 #!/usr/bin/env python
2
3 import unittest
4 import planet
5 import tempfile
6 import ConfigParser
7
8 class FakePlanet:
9     """
10     A dummy Planet object that's enough to fool the
11     Channel.__init__ method
12     """
13
14     def __init__(self):
15         self.cache_directory = tempfile.gettempdir()
16         self.config = ConfigParser.ConfigParser()
17
18 class FeedInformationTest(unittest.TestCase):
19     """
20     Test the Channel.feed_information method
21     """
22
23     def setUp(self):
24         self.url = 'URL'
25         self.changed_url = 'Changed URL'
26         self.channel = planet.Channel(FakePlanet(), self.url)
27
28     def test_unchangedurl(self):
29         self.assertEqual(self.channel.feed_information(), '<%s>' % self.url)
30                
31     def test_changedurl(self):
32         # change the URL directly
33         self.channel.url = self.changed_url
34         self.assertEqual(self.channel.feed_information(),
35            "<%s> (formerly <%s>)" % (self.changed_url, self.url))
36
37 if __name__ == '__main__':
38     unittest.main()