Example #1
0
                    def test_should_raises_invalid_python_code_error(self):
                        with pytest.raises(InvalidPythonCodeError) as excinfo:
                            CodeEvaluator.evaluate("${{1/0}}", {})

                        assert (str(excinfo.value) ==
                                "Invalid Python code defined in the API spec. "
                                "Exception: division by zero. Code: 1/0.")
Example #2
0
    def test_should_raises_invalid_python_code_error(
        self, sequence, spec_vars, is_a_test_case
    ):
        with raises(InvalidPythonCodeError) as excinfo:
            CodeEvaluator.evaluate(sequence, spec_vars, is_a_test_case)

        assert isinstance(excinfo.value, InvalidPythonCodeError)
                    def test_should_raises_invalid_python_code_error(self):
                        with pytest.raises(InvalidPythonCodeError) as excinfo:
                            CodeEvaluator.evaluate(
                                "${{response.url == 'abc'}}", {},
                                is_a_test_case=True)

                        assert (
                            str(excinfo.value) ==
                            "Invalid Python code defined in the API spec. "
                            "Exception: 'NoneType' object has no attribute 'url'. "
                            "Code: response.url == 'abc'.")
Example #4
0
 def test_should_return_assert_results(
         self, sequence, expected, response):
     assert (CodeEvaluator.evaluate(
         sequence,
         {"response": response},
         is_a_test_case=True,
     ) == expected)
Example #5
0
 def test_should_return_evaluated_code(
     self, sequence, expected, response
 ):
     assert (
         CodeEvaluator.evaluate(sequence, {"response": response})
         == expected
     )
Example #6
0
 def test_should_return_evaluated_code(self, sequence,
                                       expected):
     assert CodeEvaluator.evaluate(sequence, {}) == expected
Example #7
0
 def test_should_return_assert_results(self, sequence,
                                       expected):
     assert (CodeEvaluator.evaluate(
         sequence, {}, is_a_test_case=True) == expected)
Example #8
0
 def test_should_return_sequence(self, sequence):
     assert CodeEvaluator.evaluate(sequence, {}) == sequence