Beispiel #1
0
def test_invalid_operator():
    expected_predicate = Predicate(operator="deepEquals")
    predicate_structure = expected_predicate.as_structure()
    # Adds another operator
    predicate_structure["equals"] = {}
    with pytest.raises(Predicate.InvalidPredicateOperator):
        Predicate.from_structure(predicate_structure)
Beispiel #2
0
def test_default_predicate():
    # Given
    predicate = Predicate()

    # When
    structure = predicate.as_structure()

    # Then
    assert_that(structure, has_entries(caseSensitive=True, equals=has_entries()))
Beispiel #3
0
def test_structure_xpath():
    expected_predicate = Predicate(xpath="darwin")
    predicate_structure = expected_predicate.as_structure()
    predicate = BasePredicate.from_structure(predicate_structure)
    assert predicate.xpath == expected_predicate.xpath
Beispiel #4
0
def test_structure_operator():
    expected_predicate = Predicate(operator="deepEquals")
    predicate_structure = expected_predicate.as_structure()
    predicate = BasePredicate.from_structure(predicate_structure)
    assert predicate.operator == expected_predicate.operator
Beispiel #5
0
def test_structure_headers():
    expected_predicate = Predicate(headers={"key": "value"})
    predicate_structure = expected_predicate.as_structure()
    predicate = BasePredicate.from_structure(predicate_structure)
    assert predicate.headers == expected_predicate.headers
Beispiel #6
0
def test_structure_query():
    expected_predicate = Predicate(query={"key": "value"})
    predicate_structure = expected_predicate.as_structure()
    predicate = BasePredicate.from_structure(predicate_structure)
    assert predicate.query == expected_predicate.query
Beispiel #7
0
def test_structure_method():
    expected_predicate = Predicate(method="GET")
    predicate_structure = expected_predicate.as_structure()
    predicate = BasePredicate.from_structure(predicate_structure)
    assert predicate.method == expected_predicate.method
Beispiel #8
0
def test_structure_body():
    expected_predicate = Predicate(body="darwin")
    predicate_structure = expected_predicate.as_structure()
    predicate = BasePredicate.from_structure(predicate_structure)
    assert predicate.body == expected_predicate.body
Beispiel #9
0
def test_structure_path():
    expected_predicate = Predicate(path="/darwin")
    predicate_structure = expected_predicate.as_structure()
    predicate = BasePredicate.from_structure(predicate_structure)
    assert_that(predicate, instance_of(Predicate))
    assert predicate.path == expected_predicate.path
Beispiel #10
0
def test_structure_path():
    expected_predicate = Predicate(path="/darwin")
    predicate_structure = expected_predicate.as_structure()
    predicate = Predicate.from_structure(predicate_structure)
    assert predicate.path == expected_predicate.path