~nataliabidart/software-center/winged-migration

« back to all changes in this revision

Viewing changes to tests/test_ppa_iconfilename.py

  • Committer: Natalia B. Bidart
  • Date: 2012-05-30 18:39:55 UTC
  • mto: This revision was merged to the branch mainline in revision 3030.
  • Revision ID: natalia.bidart@canonical.com-20120530183955-zbnjczayktmmg5tv
- Initial test cleanup:
  - Renamed test/ dir to tests/.
  - Isolated test code into tests/ directory, including moving all the
    get_test_window_foo from the gtk3 production modules to
    tests/gtk3/windows.py module.
  - Removed all the calls to Gtk.main() in gtk3 tests since that blocks the
    execution of the suite.
  - Pep8 and pyflakes fixes in the files already modified in this branch.
  - Minor bug fix in the softwarecenter/log.py module when trying to create a
    log dir with proper perms.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
 
 
3
1
import unittest
4
2
 
5
 
from testutils import setup_test_env
 
3
from tests.utils import (
 
4
    setup_test_env,
 
5
)
6
6
setup_test_env()
7
7
from softwarecenter.distro.Ubuntu import Ubuntu
8
8
 
 
9
 
9
10
class MockCache(object):
10
11
    def __init__(self, mock_base_url):
11
12
        self._baseurl = mock_base_url
16
17
    def __contains__(self, k):
17
18
        return True
18
19
 
 
20
 
19
21
class MockPackage(object):
20
22
    def __init__(self, parent, pkgname):
21
23
        self._parentcache = parent
24
26
    def candidate(self):
25
27
        return MockVersion(self)
26
28
 
 
29
 
27
30
class MockVersion(object):
28
31
    def __init__(self, parent, version="1.0"):
29
32
        self._parentpkg = parent
34
37
        baseurl = self._parentpkg._parentcache._baseurl
35
38
        return "%s/pool/main/%s/%s/%s_%s_all.deb" % (
36
39
            baseurl, pkgname[0], pkgname, pkgname, self._version)
37
 
                                                     
 
40
 
38
41
 
39
42
class TestDistroUbuntu(unittest.TestCase):
40
43
 
51
54
                         "http://ppa.launchpad.net/mvo/meta/ppa/iconfilename")
52
55
 
53
56
if __name__ == "__main__":
54
 
    import logging
55
 
    logging.basicConfig(level=logging.DEBUG)
56
57
    unittest.main()