Ejemplo n.º 1
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.º 2
0
    def test_init(self):

        increment = IncrementEntry(
            self.root_path,
            b'my_filename.txt.2014-11-02T17:23:41-05:00.diff.gz')
        self.assertEqual(rdwTime(1414967021), increment.date)
        self.assertEqual(b'my_filename.txt', increment.filename)
Ejemplo n.º 3
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.º 4
0
 def test_errors(self):
     increment = IncrementEntry(
         self.root_path, b'error_log.2015-11-19T07:27:46-05:00.data')
     entry = HistoryEntry(self.repo, increment.date)
     self.assertTrue(entry.has_errors)
     self.assertEqual(
         'SpecialFileError home/coucou Socket error: AF_UNIX path too long',
         entry.errors)
Ejemplo n.º 5
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)
Ejemplo n.º 6
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.º 7
0
    def test_extract_date(self):

        self.assertEqual(rdwTime(1414967021), IncrementEntry.extract_date(b'my_filename.txt.2014-11-02T17:23:41-05:00.diff.gz'))
Ejemplo n.º 8
0
    def test_extract_date(self):

        self.assertEqual(
            rdwTime(1414967021),
            IncrementEntry.extract_date(
                b'my_filename.txt.2014-11-02T17:23:41-05:00.diff.gz'))