buildframework/helium/tools/common/python/lib/test/test_ccm_results.py
changeset 179 d8ac696cc51f
parent 1 be27ed110b50
equal deleted inserted replaced
1:be27ed110b50 179:d8ac696cc51f
    29 
    29 
    30 logger = logging.getLogger('test.ccm_results')
    30 logger = logging.getLogger('test.ccm_results')
    31 logging.basicConfig(level=logging.INFO)
    31 logging.basicConfig(level=logging.INFO)
    32 
    32 
    33 class CounterHandler(logging.Handler):
    33 class CounterHandler(logging.Handler):
    34     """ 
       
    35     """
       
    36     def __init__(self, level=logging.NOTSET):
    34     def __init__(self, level=logging.NOTSET):
    37         logging.Handler.__init__(self, level)
    35         logging.Handler.__init__(self, level)
    38         self.warnings = 0
    36         self.warnings = 0
    39         self.errors = 0
    37         self.errors = 0
    40         self.infos = 0
    38         self.infos = 0
   216 Update complete.
   214 Update complete.
   217 """}
   215 """}
   218         session = MockResultSession(behave)
   216         session = MockResultSession(behave)
   219         result = session.execute('test_update', ccm.UpdateResult(session))
   217         result = session.execute('test_update', ccm.UpdateResult(session))
   220         #logger.debug(result.output)
   218         #logger.debug(result.output)
   221         assert(len(result.output['tasks'])==4, "Number of tasks doesn't match.")
   219         assert len(result.output['tasks']) == 4, "Number of tasks doesn't match."
   222         assert(len(result.output['modifications'])==4, "Number of modifications doesn't match.")
   220         assert len(result.output['modifications']) == 4, "Number of modifications doesn't match."
   223         assert(len(result.output['errors'])==1, "Number of errors doesn't match.")
   221         assert len(result.output['errors']) == 1, "Number of errors doesn't match."
   224 
   222 
   225     def test_update_result_serious_failure(self):
   223     def test_update_result_serious_failure(self):
   226         """ Validating UpdateResult with serious failure."""        
   224         """ Validating UpdateResult with serious failure."""        
   227         behave = {'test_update' :"""Starting update process...
   225         behave = {'test_update' :"""Starting update process...
   228 
   226 
   253         #logger.debug(len(result.output['tasks']))
   251         #logger.debug(len(result.output['tasks']))
   254         #logger.debug(len(result.output['modifications']))
   252         #logger.debug(len(result.output['modifications']))
   255         #logger.debug(len(result.output['errors']))
   253         #logger.debug(len(result.output['errors']))
   256         #logger.debug(len(result.output['warnings']))
   254         #logger.debug(len(result.output['warnings']))
   257         
   255         
   258         assert ((len(result.output['tasks'])==0), "Number of tasks doesn't match.")
   256         assert (len(result.output['tasks']) == 0), "Number of tasks doesn't match."
   259         assert ((len(result.output['modifications'])==0), "Number of modifications doesn't match.")
   257         assert (len(result.output['modifications']) == 0), "Number of modifications doesn't match."
   260         assert ((len(result.output['errors'])==3), "Number of errors doesn't match.")
   258         assert (len(result.output['errors']) == 1), "Number of errors doesn't match."
   261         assert ((len(result.output['warnings'])==5), "Number of warnings doesn't match.")
   259         assert (len(result.output['warnings']) == 5), "Number of warnings doesn't match."
   262 
   260 
   263 
   261 
   264     def test_UpdateTemplateInformation_result(self):        
   262     def test_UpdateTemplateInformation_result(self):        
   265         """ Validating UpdateTemplateInformation."""                
   263         """ Validating UpdateTemplateInformation."""                
   266         behave = {'test_update' : """Baseline Selection Mode: Latest Baseline Projects
   264         behave = {'test_update' : """Baseline Selection Mode: Latest Baseline Projects
   277     Folder   tr1s60#4930: All tasks for release AppBaseDo_50        
   275     Folder   tr1s60#4930: All tasks for release AppBaseDo_50        
   278         """}
   276         """}
   279         session = MockResultSession(behave)
   277         session = MockResultSession(behave)
   280         result = session.execute('test_update', ccm.UpdateTemplateInformation(session))
   278         result = session.execute('test_update', ccm.UpdateTemplateInformation(session))
   281         #logger.debug(result.output)
   279         #logger.debug(result.output)
   282         assert(result.output['baseline_selection_mode']== "Latest Baseline Projects", "BSM doesn't match.")
   280         assert result.output['baseline_selection_mode'] == "Latest Baseline Projects", "BSM doesn't match."
   283         assert(result.output['prep_allowed']== False, "Prep allowed doesn't match.")
   281         assert result.output['prep_allowed'] == False, "Prep allowed doesn't match."
   284         assert(result.output['version_matching']== "*abs.50*", "Version matching doesn't match.")
   282         assert result.output['version_matching'] == "*abs.50*", "Version matching doesn't match."
   285         assert(result.output['release_purpose']== "", "Release purpose doesn't match.")
   283         assert result.output['release_purpose'] == "", "Release purpose doesn't match."
   286         assert(result.output['modifiable_in_database']== "tr1s60", "Modifiable in Database doesn't match.")
   284         assert result.output['modifiable_in_database'] == "tr1s60", "Modifiable in Database doesn't match."
   287         assert(result.output['in_use_for_release']== True, "In Use For Release doesn't match.")
   285         assert result.output['in_use_for_release'] == True, "In Use For Release doesn't match."
   288     
   286     
   289     def test_ConflictsResult_result(self):        
   287     def test_ConflictsResult_result(self):        
   290         """ Validating ConflictsResult."""                
   288         """ Validating ConflictsResult."""                
   291         behave = {'test_update' : """        
   289         behave = {'test_update' : """        
   292 Project: Cartman-Release_v4
   290 Project: Cartman-Release_v4