Exemplo n.º 1
0
    def testSortSubDirectories(self):
        expected_list = ['20120912072912', '20120912073312', '20120913072230']
        monitor = FileMonitor(self.device_name)
        monitor.setInboxPath(self.temp_dir)
        # call property setter for testing
        actual_list = monitor.sortSubDirectories()
#        print actual_list
        result = cmp(expected_list, actual_list)
        # print "result:" + str(result)
        self.assertEquals(0, result, 'number not equals')
Exemplo n.º 2
0
 def testSortFiles(self):
     dest_dir =  os.path.join(self.temp_dir, "20120913072230")
     actual_list = FileMonitor.SortFiles(dest_dir)
     #expected_list = ['audit.log.3.gz','audit.log.2.gz','audit.log.1.gz']
     expected_list = ['audit.log.2.gz','audit.log.1.gz']
     result = cmp(expected_list, actual_list)
     self.assertEquals(0, result, 'sorted files not in descend order')
Exemplo n.º 3
0
    def testParseZippedFiles(self):
        '''def parseZippedFiles(self,directory): 47 + 21 = 68'''
        
        test_dir = self.temp_dir + '/20120913072230/'
#        print test_dir
        monitor = FileMonitor(self.device_name)
        monitor.setInboxPath(self.temp_dir)
#        print monitor.__dict__
        monitor.parseZippedFiles(test_dir)
        num_events = self.db.count('events')
        self.db.removeAll('events')
        self.assertEquals(85, num_events, 'events collection should have 85 documents')
Exemplo n.º 4
0
 def testHasZipFile(self):
     dest_dir =  os.path.join(self.temp_dir, "20120913072230")
     
     self.assertTrue(FileMonitor.HasZipFile(dest_dir), 
                      "directory 20120913072230 should not be empty")