~ubuntu-branches/ubuntu/raring/software-center/raring-proposed

« back to all changes in this revision

Viewing changes to tests/test_categories.py

  • Committer: Package Import Robot
  • Author(s): Michael Vogt
  • Date: 2012-10-11 15:33:05 UTC
  • mfrom: (195.1.18 quantal)
  • Revision ID: package-import@ubuntu.com-20121011153305-fm5ln7if3rpzts4n
Tags: 5.4.1.1
* lp:~mvo/software-center/reinstall-previous-purchase-token-fix:
  - fix reinstall previous purchases that have a system-wide
    license key LP: #1065481
* lp:~mvo/software-center/lp1060106:
  - Add missing gettext init for utils/update-software-center-agent
    (LP: #1060106)

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    def test_recommends_category(self, AgentMockCls):
26
26
        # ensure we use the same instance in test and code
27
27
        agent_mock_instance = AgentMockCls.return_value
28
 
        recommends_cat = RecommendedForYouCategory()
 
28
        recommends_cat = RecommendedForYouCategory(self.db)
29
29
        docids = recommends_cat.get_documents(self.db)
30
30
        self.assertEqual(docids, [])
31
31
        self.assertTrue(agent_mock_instance.query_recommend_me.called)
42
42
        cats = parser.parse_applications_menu(DATA_DIR)
43
43
        # "2" is a multimedia query
44
44
        #     see ./test/data/desktop/software-center.menu
45
 
        recommends_cat = RecommendedForYouCategory(cats[2])
 
45
        recommends_cat = RecommendedForYouCategory(self.db,
 
46
                                                   subcategory=cats[2])
46
47
        # ensure we get a query when the callback is called
47
48
        recommends_cat._recommend_me_result(
48
49
                                None,
54
55
        query = get_query_for_category(self.db, "Education")
55
56
        self.assertNotEqual(query, None)
56
57
 
 
58
 
57
59
class TestCatParsing(unittest.TestCase):
58
60
    """ tests the "where is it in the menu" code """
59
61
 
80
82
        for doc in docs:
81
83
            self.assertEqual(type(doc), xapian.Document)
82
84
 
 
85
 
83
86
class TestCategoryTemplates(unittest.TestCase):
84
87
 
85
88
    @classmethod
99
102
        mock_get_region_cached.return_value = { "countrycode" : "us",
100
103
                                              }
101
104
        parser = CategoriesParser(self.db)
102
 
        cats = parser.parse_applications_menu(DATA_DIR)
 
105
        cats = parser.parse_applications_menu(DATA_DIR, use_cache=False)
103
106
        cat = get_category_by_name(cats, 'Dynamic')
104
107
        self.assertEqual(
105
108
            "%s" % cat.query,