Ejemplo n.º 1
0
    def test_display_name(self):
        """Check if display name is unquoted and unicode."""
        entry = DirEntry(self.root_path, b'my_dir', True, [])
        self.assertEqual('my_dir', entry.display_name)

        entry = DirEntry(self.root_path, b'my;090dir', True, [])
        self.assertEqual('myZdir', entry.display_name)
Ejemplo n.º 2
0
 def test_file_size_without_stats(self):
     increments = [
         IncrementEntry(self.root_path,
                        b'my_file.2014-11-05T16:04:30-05:00.dir')
     ]
     entry = DirEntry(self.root_path, b'my_file', False, increments)
     self.assertEqual(0, entry.file_size)
Ejemplo n.º 3
0
 def test_init(self):
     entry = DirEntry(self.root_path, b'my_filename.txt', False, [])
     self.assertFalse(entry.isdir)
     self.assertFalse(entry.exists)
     self.assertEqual(os.path.join(b'my_filename.txt'), entry.path)
     self.assertEqual(os.path.join(self.repo.full_path, b'my_filename.txt'),
                      entry.full_path)
Ejemplo n.º 4
0
 def test_restore_dates(self):
     increments = [
         IncrementEntry(self.root_path,
                        b'my_dir.2014-11-05T16:04:30-05:00.dir'),
         IncrementEntry(self.root_path,
                        b'my_dir.2014-11-05T16:04:55-05:00.dir')
     ]
     entry = DirEntry(self.root_path, b'my_dir', False, increments)
     self.assertEqual([
         rdwTime(1415221470),
         rdwTime(1415221495),
     ], entry.restore_dates)
Ejemplo n.º 5
0
 def test_file_size(self):
     increments = [
         IncrementEntry(
             self.root_path,
             bytes(
                 '<F!chïer> (@vec) {càraçt#èrë} $épêcial.2014-11-05T16:05:07-05:00.dir',
                 encoding='utf-8'))
     ]
     entry = DirEntry(
         self.root_path,
         bytes('<F!chïer> (@vec) {càraçt#èrë} $épêcial', encoding='utf-8'),
         False, increments)
     self.assertEqual(286, entry.file_size)
Ejemplo n.º 6
0
    def test_change_dates(self):
        """Check if dates are properly sorted."""
        increments = [
            IncrementEntry(
                self.root_path,
                b'my_filename.txt.2014-11-02T17:23:41-05:00.diff.gz'),
            IncrementEntry(
                self.root_path,
                b'my_filename.txt.2014-11-02T09:16:43-05:00.missing'),
            IncrementEntry(
                self.root_path,
                b'my_filename.txt.2014-11-03T19:04:57-05:00.diff.gz')
        ]
        entry = DirEntry(self.root_path, b'my_filename.txt', False, increments)

        self.assertEqual(
            [rdwTime(1414939853),
             rdwTime(1414967021),
             rdwTime(1415059497)], entry.change_dates)