~entertainer-releases/entertainer/trunk

« back to all changes in this revision

Viewing changes to entertainerlib/tests/test_feedconfigtools.py

  • Committer: Matt Layman
  • Date: 2010-04-03 15:10:28 UTC
  • mfrom: (403.1.12 bye-feedz)
  • Revision ID: laymansterms.dev@gmail.com-20100403151028-fxbe7g64z129ohu6
All feed code is now removed. Lots of pylint cleanup too. (Matt Layman)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (c) 2009 Entertainer Developers - See COPYING - GPLv2
2
 
'''Test FeedConfigTools'''
3
 
 
4
 
import os
5
 
 
6
 
import gtk
7
 
 
8
 
from entertainerlib.backend.components.feeds.feed_utils import FeedConfigTools
9
 
from entertainerlib.tests import EntertainerTest
10
 
 
11
 
THIS_DIR = os.path.dirname(__file__)
12
 
 
13
 
 
14
 
class FeedConfigToolsTest(EntertainerTest):
15
 
    # pylint: disable-msg=C0301
16
 
    # This pylint warning can be removed when the backend stuff gets removed,
17
 
    # and the pieces we keep get rearranged.
18
 
    '''Test for entertainerlib.backend.components.feeds.feed_utils.FeedConfigTools'''
19
 
 
20
 
    def setUp(self):
21
 
        """Sets up everything for the test"""
22
 
        EntertainerTest.setUp(self)
23
 
 
24
 
        #setup feeds and model
25
 
        self.feeds = self.config.feeds
26
 
        self.model = gtk.ListStore(str)
27
 
        for i in range(len(self.feeds)):
28
 
            self.model.insert(i, [self.feeds[i]])
29
 
 
30
 
        self.files = [THIS_DIR + "/data/FeedConfigTools/test.opml"]
31
 
 
32
 
        self.feedList = [
33
 
            u'http://www.hackaday.com/rss.xml',
34
 
            u'http://edevelop.org/planet/rss20.xml',
35
 
            u'http://feeds.feedburner.com/BlenderartMagazine'
36
 
            ]
37
 
 
38
 
        self.result_feed_list = self.feeds + self.feedList
39
 
 
40
 
        self.feed_config_tools = FeedConfigTools()
41
 
 
42
 
    def tearDown(self):
43
 
        """restores config to how it should be to start off"""
44
 
        EntertainerTest.tearDown(self)
45
 
 
46
 
    def testAddFileFeedsToWidget001(self):
47
 
        """Tests if self.feeds is updated correctly"""
48
 
        self.feed_config_tools.add_file_feeds_to_widget(
49
 
            self.files, self.model, self.feeds, False)
50
 
        self.assertEqual(self.feeds, self.result_feed_list)
51
 
 
52
 
    def testAddFileFeedsToWidget002(self):
53
 
        """Tests if self.config is updated correctly"""
54
 
        self.feed_config_tools.add_file_feeds_to_widget(
55
 
            self.files, self.model, self.feeds, False)
56
 
        self.assertEqual(self.config.feeds, self.result_feed_list)
57
 
 
58
 
    def testAddFeedsToWidget001(self):
59
 
        """Tests if self.feeds is updated correctly"""
60
 
        self.feed_config_tools.add_feeds_to_widget(
61
 
            self.feedList, self.model, self.feeds)
62
 
        self.assertEqual(self.feeds, self.result_feed_list)
63
 
 
64
 
    def testAddFeedsToWidget002(self):
65
 
        """Tests if self.config is updated correctly"""
66
 
        self.feed_config_tools.add_feeds_to_widget(
67
 
            self.feedList, self.model, self.feeds)
68
 
        self.assertEqual(self.config.feeds, self.result_feed_list)
69