~didrocks/oneconf/testmerge

« back to all changes in this revision

Viewing changes to test/test_mainfeatures.py

  • Committer: Didier Roche
  • Date: 2012-06-08 12:53:35 UTC
  • Revision ID: didrocks@ubuntu.com-20120608125335-uaaybriflyoeei8o
handle a regression when the wallpaper isn't reachable + test case
(LP: #1010239)

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
shutil.copy(os.path.join(os.path.dirname(__file__), "data", "oneconf.override"), "/tmp/oneconf.override")
32
32
from oneconf import paths
 
33
import oneconf.hosts
33
34
from oneconf.hosts import HostError
34
35
from oneconf import directconnect
35
36
from oneconf.directconnect import DirectConnect
45
46
        self.hostdir = os.path.join(paths.ONECONF_CACHE_DIR, self.hostid)
46
47
        shutil.copytree(os.path.join(os.path.dirname(__file__), "data", "hostdata"), self.hostdir)
47
48
        self.src_hostdir = None
 
49
        # TODO: reload path because some tests have other oneconf override files. Should be real mock objects later on.
 
50
        shutil.copy(os.path.join(os.path.dirname(__file__), "data", "oneconf.override"), "/tmp/oneconf.override")
 
51
        reload(paths)
 
52
        reload(oneconf.hosts)
48
53
            
49
54
    def tearDown(self):
50
55
        shutil.rmtree(os.path.dirname(paths.ONECONF_CACHE_DIR))
226
231
        self.assertEqual(packageset._get_packagelist_from_store(self.hostid), {'foo': {'auto': False}, 'pool': {'auto': True}})
227
232
        self.assertEqual(packageset.hosts.current_host['packages_checksum'], '60f28c520e53c65cc37e9b68fe61911fb9f73ef910e08e988cb8ad52')        
228
233
        
 
234
    def test_no_valid_wallpaper(self):
 
235
        '''Test that no crash occurs with an invalid wallpaper URL'''
 
236
        shutil.copy(os.path.join(os.path.dirname(__file__), "data", "oneconf.invalidwallpaper.override"), "/tmp/oneconf.override")
 
237
        reload(paths)
 
238
        reload(oneconf.hosts)
 
239
        host = oneconf.hosts.Hosts()
 
240
        self.assertEqual(host._get_current_wallpaper_data(), (None, None))
 
241
 
229
242
    # TODO: ensure a logo is updated
230
243
    
231
244
#