def test_regex_no_match_header(self): response = FakeResponse("abchelloabc") with pytest.raises(exceptions.RegexAccessError): validate_regex(response, "(?P<greeting>hola)", header="test_header")
def test_regex_match_header(self): response = FakeResponse("abchelloabc") matched = validate_regex(response, "(?P<greeting>hello)", "test_header") assert "greeting" in matched["regex"]
def test_in_jmespath(self, match): response = FakeResponse( json.dumps({ "path1": "val1", "path2": ["val2"], "path3": { "sub": "val3" } })) expression, path, expected = match result = validate_regex(response, expression, in_jmespath=path) assert result["regex"]["num"] == expected[-1]
def test_regex_no_match_header(self): response = FakeResponse("abchelloabc") with pytest.raises(AssertionError): validate_regex(response, "(?P<greeting>hola)", "test_header")