~mandel/ubuntuone-client/add-virtual-watches

« back to all changes in this revision

Viewing changes to tests/platform/test_os_helper.py

  • Committer: manuel.delapena at canonical
  • Date: 2012-01-16 12:16:27 UTC
  • mfrom: (1176.1.3 ubuntuone-client)
  • Revision ID: manuel.delapena@canonical.com-20120116121627-2tbt1ed9d43m21zx
Made code more efficient by using sets instead of collections.

Show diffs side-by-side

added added

removed removed

Lines of Context:
311
311
        """The dir is not there."""
312
312
        self.assertFalse(path_exists(os.path.join(self.basedir, 'subdir')))
313
313
 
 
314
    def test_path_exist_for_link_without_lnk_extension(self):
 
315
        """Test if the path of a link exist without the lnk extension."""
 
316
        destination = os.path.join(self.basedir, 'destination')
 
317
        make_link(self.testfile, destination)
 
318
        self.assertTrue(path_exists(destination))
 
319
 
314
320
    def test_make_link(self):
315
321
        """The link is properly made."""
316
322
        destination = os.path.join(self.basedir, 'destination')
320
326
        self.assertEqual(os.path.normcase(self.testfile),
321
327
                         os.path.normcase(read_link(destination)))
322
328
 
 
329
    def _assert_read_link(self, target):
 
330
        """Assert if the target path of the link is correct."""
 
331
        destination = os.path.join(self.basedir, target)
 
332
        make_link(self.testfile, destination)
 
333
 
 
334
        target = read_link(destination)
 
335
        self.assertEqual(self.testfile, target)
 
336
 
 
337
    def test_links_target_without_lnk_extension(self):
 
338
        """Create a link to self.testfile and then retrieve the link target."""
 
339
        # In windows the .lnk extension should be added automatically
 
340
        # if the extension is not added by make_link, read_link will fail
 
341
        # because Windows is not going to recognize the file as a link
 
342
        target = 'target'
 
343
        self._assert_read_link(target)
 
344
 
 
345
    def test_links_target_with_lnk_extension(self):
 
346
        """Create a link to self.testfile and then retrieve the link target."""
 
347
        target = 'target.lnk'
 
348
        self._assert_read_link(target)
 
349
 
323
350
    def test_movetotrash_file_ok(self):
324
351
        """Move a file to trash ok.
325
352