~nataliabidart/software-center/winged-migration

« back to all changes in this revision

Viewing changes to tests/test_downloader.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
from gi.repository import GObject
4
2
 
5
3
import os
6
4
import time
7
5
import unittest
8
6
 
9
 
from testutils import setup_test_env
 
7
from tests.utils import (
 
8
    setup_test_env,
 
9
)
10
10
setup_test_env()
11
11
from softwarecenter.utils import SimpleFileDownloader
12
12
 
 
13
 
13
14
class TestImageDownloader(unittest.TestCase):
14
15
 
15
16
    DOWNLOAD_FILENAME = "test_image_download"
48
49
        self.assertNotEqual(self._image_is_reachable, None)
49
50
        self.assertFalse(self._image_is_reachable)
50
51
        self.assertTrue(not os.path.exists(self.DOWNLOAD_FILENAME))
51
 
 
 
52
 
52
53
    def test_download_reachable(self):
53
54
        self.downloader.download_file("http://www.ubuntu.com",
54
55
                                      self.DOWNLOAD_FILENAME)
63
64
        self.assertTrue(os.path.exists(self.DOWNLOAD_FILENAME))
64
65
 
65
66
if __name__ == "__main__":
66
 
    import logging
67
 
    logging.basicConfig(level=logging.DEBUG)
68
67
    unittest.main()