Ejemplo n.º 1
0
 def testGetDefaultSubsystem(self):
     """Test if we can get default subsystem when subsystem is not specified."""
     change = sync_stages_unittest.MockPatch(
         commit_message='First line\nThird line\n')
     self.PatchObject(triage_lib, 'GetOptionForChange', return_value=None)
     result = triage_lib.GetTestSubsystemForChange('foo/build/root', change)
     self.assertEqual(['default'], result)
 def testGetSubsystemFromInvalidCommitMessage(self):
   """Test get subsystem from config file when commit message not have it."""
   change = sync_stages_unittest.MockPatch(
       commit_message='First line\nThird line\n')
   self.PatchObject(triage_lib, 'GetOptionForChange',
                    return_value='power light')
   result = triage_lib.GetTestSubsystemForChange('foo/build/root', change)
   self.assertEqual(['power', 'light'], result)
 def testGetSubsystemFromValidCommitMessage(self):
   """Test whether we can get subsystem from commit message."""
   change = sync_stages_unittest.MockPatch(
       commit_message='First line\nThird line\nsubsystem: network audio\n'
                      'subsystem: wifi')
   self.PatchObject(triage_lib, 'GetOptionForChange',
                    return_value='power light')
   result = triage_lib.GetTestSubsystemForChange('foo/build/root', change)
   self.assertEqual(['network', 'audio', 'wifi'], result)
 def _GetPatch(self, affected_files):
   return sync_stages_unittest.MockPatch(
       mock_diff_status={path: 'M' for path in affected_files})