def testDetermineCtsRelease_tooLow(self): device = mock.Mock(build_version_sdk=version_codes.LOLLIPOP_MR1) with self.assertRaises(Exception) as cm: run_cts.DetermineCtsRelease(device) message = str(cm.exception) self.assertIn("We don't support running CTS tests on platforms less than", message)
def testDetermineCtsRelease_marshmallow(self): logging_mock = mock.Mock() logging.info = logging_mock device = mock.Mock(build_version_sdk=version_codes.MARSHMALLOW) self.assertEqual(run_cts.DetermineCtsRelease(device), 'M') # We should log a message to explain how we auto-determined the CTS release. # We don't assert the message itself, since that's rather strict. logging_mock.assert_called()
def testDetermineCtsRelease_tooHigh(self): device = mock.Mock(build_version_sdk=version_codes.OREO) # Mock this out with a couple version codes to check that the logic is # correct, without making assumptions about what version_codes we may # support in the future. mock_sdk_platform_dict = { version_codes.MARSHMALLOW: 'min fake release', version_codes.NOUGAT: 'max fake release', } run_cts.SDK_PLATFORM_DICT = mock_sdk_platform_dict with self.assertRaises(Exception) as cm: run_cts.DetermineCtsRelease(device) message = str(cm.exception) self.assertIn('--cts-release max fake release', message, msg='Should recommend the highest supported CTS release')
def testDetermineCtsRelease_tooLow(self): device = mock.Mock(build_version_sdk=version_codes.KITKAT) with self.assertRaises(Exception) as cm: run_cts.DetermineCtsRelease(device) message = str(cm.exception) self.assertIn('not updatable', message)