1caa36e4a6dd8ac3653439d8c58e7f6f587995be
2 # This file is part of my.gpodder.org.
4 # my.gpodder.org is free software: you can redistribute it and/or modify it
5 # under the terms of the GNU Affero General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or (at your
7 # option) any later version.
9 # my.gpodder.org is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
12 # License for more details.
14 # You should have received a copy of the GNU Affero General Public License
15 # along with my.gpodder.org. If not, see <http://www.gnu.org/licenses/>.
21 from django
.test
import TestCase
24 from mygpo
.core
.models
import Podcast
, PodcastGroup
27 class PodcastGroupTests(unittest
.TestCase
):
30 self
.podcast1
= Podcast(urls
=['http://example1.com'])
33 self
.podcast2
= Podcast(urls
=['http://example2.com'])
36 group
= self
.podcast1
.group_with(self
.podcast2
, 'My Group', 'p1', 'p2')
38 self
.assertIn(self
.podcast1
, group
.podcasts
)
39 self
.assertIn(self
.podcast2
, group
.podcasts
)
40 self
.assertEquals(len(group
.podcasts
), 2)
41 self
.assertEquals(group
.title
, 'My Group')
42 self
.assertEquals(self
.podcast1
.group_member_name
, 'p1')
43 self
.assertEquals(self
.podcast2
.group_member_name
, 'p2')
46 self
.podcast3
= Podcast(urls
=['http://example3.com'])
49 group
= self
.podcast1
.group_with(self
.podcast3
, 'My Group', 'p1', 'p3')
51 self
.assertIn(self
.podcast3
, group
.podcasts
)
52 self
.assertEquals(self
.podcast3
.group_member_name
, 'p3')
54 # add group to podcast
55 self
.podcast4
= Podcast(urls
=['http://example4.com'])
58 group
= self
.podcast4
.group_with(self
.podcast1
, 'My Group', 'p4', 'p1')
60 self
.assertIn(self
.podcast4
, group
.podcasts
)
61 self
.assertEquals(self
.podcast4
.group_member_name
, 'p4')
66 suite
= unittest
.TestSuite()
67 suite
.addTest(doctest
.DocTestSuite(mygpo
.utils
))
68 suite
.addTest(unittest
.TestLoader().loadTestsFromTestCase(PodcastGroupTests
))