Exemplo n.º 1
0
    def _validate_runtime(self, runtime):
        """
        validate runtime and local runtime version to make sure they match

        :type runtime: str
        :param runtime:
            String matching a lambda runtime eg: python3.6
        """
        RuntimeValidator.validate_runtime(
            required_language=self.capability.language,
            required_runtime=runtime)
 def test_runtime_validate_mismatch_version_runtime(self):
     with mock.patch('subprocess.Popen') as mock_subprocess:
         mock_subprocess.return_value = MockSubProcess(1)
         with self.assertRaises(MisMatchRuntimeError):
             RuntimeValidator.validate_runtime("python", "python2.7")
             self.assertTrue(mock_subprocess.call_count, 1)
 def test_runtime_validate_supported_version_runtime(self):
     with mock.patch('subprocess.Popen') as mock_subprocess:
         mock_subprocess.return_value = MockSubProcess(0)
         RuntimeValidator.validate_runtime("python", "python3.6")
         self.assertTrue(mock_subprocess.call_count, 1)
 def test_runtime_validate_unsupported_runtime_version_fail_open(self):
     RuntimeValidator.validate_runtime("python", "python2.8")
 def test_runtime_validate_unsupported_language_fail_open(self):
     RuntimeValidator.validate_runtime("test_language", "test_language2.7")
 def test_supported_runtimes(self):
     self.assertTrue(RuntimeValidator.has_runtime("python2.7"))
     self.assertTrue(RuntimeValidator.has_runtime("python3.6"))
     self.assertFalse(RuntimeValidator.has_runtime("test_language"))