コード例 #1
0
ファイル: http.py プロジェクト: professor0x/Alarmageddon
    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
コード例 #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)
コード例 #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])
コード例 #4
0
def test_json_less_than():
    validation = HttpValidation.get("url")
    exp = ExpectedJsonValueLessThan("path", 5)
    exp.validate_value(validation, 5, 3)
コード例 #5
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)
コード例 #6
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])
コード例 #7
0
def test_json_less_than():
    validation = HttpValidation.get("url")
    exp = ExpectedJsonValueLessThan("path", 5)
    exp.validate_value(validation, 5, 3)