Example #1
0
    def test_get_apel_db_insert(self):
        '''Test that the method getting the data to put into the DB
        actually does retrieve the correct values.'''

        for rec_txt, rec_tuple in zip(self._records, self._tuples):

            sr = SummaryRecord()
            sr.load_from_msg(rec_txt)

            test_dn = "This is a test DN."

            # Mock object so we don't have to use an actual DB.
            values = sr.get_db_tuple(test_dn)
        for item1, item2 in zip(values, rec_tuple):
            #            if isinstance(item1, datetime):
            #                if abs(item1 - item2) > timedelta(seconds = 1):
            #                    self.fail('Datetimes %s and %s do not match.' % (item1, item2))

            if item1 != item2 and str(item1) != str(item2):
                print values
                self.fail('Values changed when creating a summary record: ' +
                          str(item1) + ": " + str(item2))
Example #2
0
    def test_get_apel_db_insert(self):
        '''Test that the method getting the data to put into the DB
        actually does retrieve the correct values.'''
        
        for rec_txt, rec_tuple in zip(self._records, self._tuples):
        
            sr = SummaryRecord()
            sr.load_from_msg(rec_txt)
        
            test_dn = "This is a test DN."
        
            # Mock object so we don't have to use an actual DB.
            values = sr.get_db_tuple(test_dn)
        for item1, item2 in zip(values, rec_tuple):
#            if isinstance(item1, datetime):
#                if abs(item1 - item2) > timedelta(seconds = 1):
#                    self.fail('Datetimes %s and %s do not match.' % (item1, item2))
                
            if item1 != item2 and str(item1) != str(item2):
                print values
                self.fail('Values changed when creating a summary record: ' +
                          str(item1) + ": " + str(item2))