Esempio n. 1
0
    def expect_json_property_value_less_than(self, json_property_path,
                                             less_than):
        """Add an expectation that the HTTP response will be JSON and contain
        a numeric property (found by traversing json_property_path) less
        than less_than.

        """
        self.add_expectation(
            ExpectedJsonValueLessThan(json_property_path, less_than))
        return self
Esempio n. 2
0
def test_json_less_than_fails():
    validation = HttpValidation.get("url")
    exp = ExpectedJsonValueLessThan("path", 5)
    with pytest.raises(ValidationFailure):
        exp.validate_value(validation, 5, 5)
Esempio n. 3
0
def test_json_less_than_wildcard():
    validation = HttpValidation.get("url")
    exp = ExpectedJsonValueLessThan("path[*]", [1, 2, 3])
    with pytest.raises(ValidationFailure):
        exp.validate_value(validation, 1, [1, 2, 3])
Esempio n. 4
0
def test_json_less_than():
    validation = HttpValidation.get("url")
    exp = ExpectedJsonValueLessThan("path", 5)
    exp.validate_value(validation, 5, 3)
def test_json_less_than_fails():
    validation = HttpValidation.get("url")
    exp = ExpectedJsonValueLessThan("path", 5)
    with pytest.raises(ValidationFailure):
        exp.validate_value(validation, 5, 5)
def test_json_less_than_wildcard():
    validation = HttpValidation.get("url")
    exp = ExpectedJsonValueLessThan("path[*]", [1, 2, 3])
    with pytest.raises(ValidationFailure):
        exp.validate_value(validation, 1, [1, 2, 3])
def test_json_less_than():
    validation = HttpValidation.get("url")
    exp = ExpectedJsonValueLessThan("path", 5)
    exp.validate_value(validation, 5, 3)