Beispiel #1
0
    def expect_json_property_value_greater_than(self, json_property_path,
                                                greater_than):
        """Add an expectation that the HTTP response will be JSON and contain
        a numeric property (found by traversing json_property_path) greater
        than greater_than.

        """
        self.add_expectation(
            ExpectedJsonValueGreaterThan(json_property_path, greater_than))
        return self
Beispiel #2
0
def test_json_greater_than_fails():
    validation = HttpValidation.get("url")
    exp = ExpectedJsonValueGreaterThan("path", 5)
    with pytest.raises(ValidationFailure):
        exp.validate_value(validation, 5, 5)
Beispiel #3
0
def test_json_greater_than_wildcard():
    validation = HttpValidation.get("url")
    exp = ExpectedJsonValueGreaterThan("path[*]", [1, 2, 3])
    with pytest.raises(ValidationFailure):
        exp.validate_value(validation, 1, [1, 2, 3])
Beispiel #4
0
def test_json_greater_than():
    validation = HttpValidation.get("url")
    exp = ExpectedJsonValueGreaterThan("path", 5)
    exp.validate_value(validation, 5, 7)
def test_json_greater_than_fails():
    validation = HttpValidation.get("url")
    exp = ExpectedJsonValueGreaterThan("path", 5)
    with pytest.raises(ValidationFailure):
        exp.validate_value(validation, 5, 5)
def test_json_greater_than_wildcard():
    validation = HttpValidation.get("url")
    exp = ExpectedJsonValueGreaterThan("path[*]", [1, 2, 3])
    with pytest.raises(ValidationFailure):
        exp.validate_value(validation, 1, [1, 2, 3])
def test_json_greater_than():
    validation = HttpValidation.get("url")
    exp = ExpectedJsonValueGreaterThan("path", 5)
    exp.validate_value(validation, 5, 7)