Merge pull request #1603 from auouymous/extract-youtube-channel-id-from-url
[gpodder.git] / tests / model.py
blob149e7a22fc3654fe88d7304a8264121c7f7d1989
1 # -*- coding: utf-8 -*-
3 # gPodder - A media aggregator and podcast client
4 # Copyright (c) 2005-2018 The gPodder Team
6 # gPodder is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # gPodder is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 # gpodder.test.model - Unit tests for gpodder.model
21 # Thomas Perl <thp@gpodder.org>; 2013-02-12
24 import unittest
26 from gpodder import model
29 class TestEpisodePublishedProperties(unittest.TestCase):
30 PUBLISHED_UNIXTIME = 1360666744
31 PUBLISHED_SORT = '2013-02-12'
32 PUBLISHED_YEAR = '13'
33 PUBLISHED_MONTH = '02'
34 PUBLISHED_DAY = '12'
36 def setUp(self):
37 self.podcast = model.PodcastChannel(None)
38 self.episode = model.PodcastEpisode(self.podcast)
39 self.episode.published = self.PUBLISHED_UNIXTIME
41 def test_sortdate(self):
42 self.assertEqual(self.episode.sortdate, self.PUBLISHED_SORT)
44 def test_pubdate_year(self):
45 self.assertEqual(self.episode.pubdate_year, self.PUBLISHED_YEAR)
47 def test_pubdate_month(self):
48 self.assertEqual(self.episode.pubdate_month, self.PUBLISHED_MONTH)
50 def test_pubdate_day(self):
51 self.assertEqual(self.episode.pubdate_day, self.PUBLISHED_DAY)