def test_should_raise_bad_configuration_error(self):
                    with pytest.raises(BadConfigurationError) as excinfo:
                        StringEvaluator._evaluate_env_var("${BASE_URL}")

                    assert (
                        str(excinfo.value) ==
                        "'BASE_URL' environment variable not set or badly configured"
                    )
Ejemplo n.º 2
0
 def test_should_replace(self, sequence, variable, variable_value, expected):
     assert (
         StringEvaluator.replace_var_with_value(
             sequence, variable, variable_value
         )
         == expected
     )
Ejemplo n.º 3
0
 def test_should_return_sequence_3(self, sequence, expected):
     vars = {
         "user_id": "10",
         "apiKey": "abc123",
         "api-token": "xwo",
     }
     assert StringEvaluator._evaluate_custom_var(sequence, vars) == expected
 def test_should_return_sequence(self, sequence):
     assert StringEvaluator._evaluate_custom_var(sequence,
                                                 {}) == sequence
 def test_should_return_evaluated_var(self, sequence, expected):
     assert StringEvaluator._evaluate_env_var(
         sequence) == expected
 def test_should_return_sequence(self, sequence):
     assert StringEvaluator._evaluate_env_var(sequence) == sequence
 def test_calls__evaluate_env_var(self, mock__evaluate_env_var):
     StringEvaluator.evaluate("boo", {})
     mock__evaluate_env_var.assert_called_once_with("boo")
 def test_calls_code_evaluate(self, mock_code_evaluate):
     StringEvaluator.evaluate("boo", {})
     mock_code_evaluate.assert_called_once_with("boo", {})
Ejemplo n.º 9
0
    def test_should_return_evaluated_var(self, sequence, expected):
        os.environ["BASE_URL"] = "https://jsonplaceholder.typicode.com"
        os.environ["POST_ID"] = "2"

        assert StringEvaluator._evaluate_env_var(sequence) == expected