Exemplo n.º 1
0
 def test_eq_with_name_is_not_equal_and_ctime_not_equal_false(self):
     nameA = self.SOME_NAME
     ctime = self.SOME_CTIME
     nameB = nameA + 'im_so_different'
     dateFileA = datafile.Datafile(nameA, ctime)
     dateFileB = datafile.Datafile(nameB, ctime)
     self.assertFalse(dateFileA == dateFileB, 'Error comparing with __eq__')
Exemplo n.º 2
0
 def test_eq_with_name_is_equal_and_ctime_is_not_equal_false(self):
     name = self.SOME_NAME
     ctimeA = self.SOME_CTIME
     ctimeB = '2011-11-12 23:23:24'
     dateFileA = datafile.Datafile(name, ctimeA)
     dateFileB = datafile.Datafile(name, ctimeB)
     self.assertFalse(dateFileA == dateFileB, 'Error comparing with __eq__')
Exemplo n.º 3
0
    def test_constructor(self):
        name = self.SOME_NAME
        ctime = self.SOME_CTIME
        dataFile = datafile.Datafile(name, ctime)

        self.assertTrue(name == dataFile.name, 'Error set name in constructor')
        self.assertTrue(ctime == dataFile.ctime,
                        'Error set cdate in constructor')
Exemplo n.º 4
0
    def test_return_oldest_file_ignore_upper_and_lower_filetypes(self):
        listdirValues = self._listdirValues()
        listdirValues.append('test3.JPG')

        ctimeValues = self._ctimeValues()
        ctimeValues['test/test3.JPG'] = '2009-03-01 23:21:34'
        self._load_os_file_stubs(listdirValues, ctimeValues)

        expected = datafile.Datafile('test/test3.JPG', '2009-03-01 23:21:34')
        self.assertEquals(expected, self.directory.get_oldest_file())
Exemplo n.º 5
0
    def test_return_oldest_file_given_some_more_files(self):
        listdirValues = self._listdirValues()
        listdirValues.append('test3.jpg')

        ctimeValues = self._ctimeValues()
        ctimeValues['test/test3.jpg'] = '2012-03-01 23:21:34'
        self._load_os_file_stubs(listdirValues, ctimeValues)

        expected = datafile.Datafile('test/test.jpg', '2012-01-01 23:21:34')
        self.assertEquals(expected, self.directory.get_oldest_file())
Exemplo n.º 6
0
    def test_return_oldest_file_with_oldest_file_in_dir_does_not_match_filetypes(
            self):
        listdirValues = self._listdirValues()
        listdirValues.append('list.xml')

        ctimeValues = self._ctimeValues()

        self._load_os_file_stubs(listdirValues, ctimeValues)

        expected = datafile.Datafile('test/test.jpg', '2012-01-01 23:21:34')
        self.assertEquals(expected, self.directory.get_oldest_file())
Exemplo n.º 7
0
    def test_return_oldest_file(self):
        self._load_os_file_stubs(self._listdirValues(), self._ctimeValues())

        expected = datafile.Datafile('test/test.jpg', '2012-01-01 23:21:34')
        self.assertEquals(expected, self.directory.get_oldest_file())
Exemplo n.º 8
0
 def test_eq_with_name_and_ctime_are_equal_is_true(self):
     name = self.SOME_NAME
     ctime = self.SOME_CTIME
     dateFileA = datafile.Datafile(name, ctime)
     dateFileB = datafile.Datafile(name, ctime)
     self.assertTrue(dateFileA == dateFileB, 'Error comparing with __eq__')