~ubuntu-branches/ubuntu/quantal/software-center/quantal-updates

« back to all changes in this revision

Viewing changes to test/test_debfileapplication.py

  • Committer: Package Import Robot
  • Author(s): Michael Vogt, Robert Roth, Sebastian Heinlein, Robert Ancell, Michael Vogt
  • Date: 2012-06-01 19:54:38 UTC
  • mfrom: (192.1.1 precise-proposed)
  • Revision ID: package-import@ubuntu.com-20120601195438-wvbelmfgll4h1kuq
Tags: 5.3.0
[ Robert Roth ]
* lp:~evfool/software-center/lp872760:
  - Updated the category name for the RasterGraphics subcategory 
    from Painting & Editing to Painting (LP: #872760)
* lp:~evfool/software-center/lp927426:
  - Changed the reference to store to Software Center, as requested in 
    bug LP: #927426
* lp:~evfool/software-center/specs-update:
  - Moved the recommended applications section after the package details
  - Moved the addon status bar after the addons list
  - Aligned the star ratings widget vertically with the titles
  - Added some vertical padding before the star ratings widget to look 
     bette
* lp:~evfool/software-center/history-enhancements:
  - display text-sized icons in history, not double-sized ones
  - use padding between the icon and the package name
  - right-align the time of the history action
  - display the action +time (installed/updated/removed) if the 
    filter is all changes, otherwise only display the time
  - removed markup from the translatable string, to avoid translation
    mistakes with markup

[ Sebastian Heinlein ]
* lp:~glatzor/software-center/remove-workaround-747172:
  - remove old workaround that should be no longer needed (LP: #747172)
    
[ Robert Ancell ]
* lp:~robert-ancell/software-center/no-lpi:
  - Drop Launchpad integration

[ Michael Vogt ]
* lp:~mvo/software-center/piston-generic-helper-offline-mode:
  - add support for offline mode to the generic helper just like
    for piston_get_reviews_helper.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
setup_test_env()
8
8
 
9
9
from softwarecenter.enums import PkgStates
10
 
from softwarecenter.db.debfile import DebFileApplication
 
10
from softwarecenter.db.debfile import DebFileApplication, DebFileOpenError
11
11
from softwarecenter.testutils import get_test_db
12
12
 
13
13
DEBFILE_PATH = './data/test_debs/gdebi-test9.deb'
22
22
DEBFILE_PATH_CORRUPT = './data/test_debs/corrupt.deb'
23
23
DEBFILE_NOT_INSTALLABLE = './data/test_debs/gdebi-test1.deb'
24
24
 
 
25
 
25
26
class TestDebFileApplication(unittest.TestCase):
26
27
    """ Test the class DebFileApplication """
27
28
 
31
32
    def test_get_name(self):
32
33
        debfileapplication = DebFileApplication(DEBFILE_PATH)
33
34
        debfiledetails = debfileapplication.get_details(self.db)
34
 
        
 
35
 
35
36
        self.assertEquals(debfiledetails.name, DEBFILE_NAME)
36
37
 
37
38
    def test_get_description(self):
64
65
        debfileapplication = DebFileApplication(DEBFILE_PATH_NOTFOUND)
65
66
        debfiledetails = debfileapplication.get_details(self.db)
66
67
        self.assertEquals(debfiledetails.pkg_state, PkgStates.NOT_FOUND)
67
 
        
 
68
 
68
69
    def test_get_pkg_state_not_a_deb(self):
69
 
        self.assertRaises(ValueError, DebFileApplication, DEBFILE_PATH_NOTADEB)
 
70
        self.assertRaises(DebFileOpenError,
 
71
                          DebFileApplication, DEBFILE_PATH_NOTADEB)
70
72
 
71
73
    def test_get_pkg_state_corrupt(self):
72
74
        debfileapplication = DebFileApplication(DEBFILE_PATH_CORRUPT)
87
89
        debfileapplication = DebFileApplication(DEBFILE_PATH)
88
90
        debfiledetails = debfileapplication.get_details(self.db)
89
91
        self.assertEquals(debfiledetails.installed_size, 0)
90
 
        
 
92
 
91
93
    def test_get_warning(self):
92
94
        debfileapplication = DebFileApplication(DEBFILE_PATH)
93
95
        debfiledetails = debfileapplication.get_details(self.db)
94
96
        self.assertEquals(debfiledetails.warning, DEBFILE_WARNING)
95
 
        
 
97
 
 
98
 
96
99
if __name__ == "__main__":
97
100
    logging.basicConfig(level=logging.DEBUG)
98
101
    unittest.main()
 
102