Ejemplo n.º 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)
Ejemplo n.º 2
0
def test_structure_xpath():
    expected_predicate = Predicate(xpath="darwin")
    predicate_structure = expected_predicate.as_structure()
    predicate = Predicate.from_structure(predicate_structure)
    assert predicate.xpath == expected_predicate.xpath
Ejemplo n.º 3
0
def test_structure_operator():
    expected_predicate = Predicate(operator="deepEquals")
    predicate_structure = expected_predicate.as_structure()
    predicate = Predicate.from_structure(predicate_structure)
    assert predicate.operator == expected_predicate.operator
Ejemplo n.º 4
0
def test_structure_headers():
    expected_predicate = Predicate(headers={"key": "value"})
    predicate_structure = expected_predicate.as_structure()
    predicate = Predicate.from_structure(predicate_structure)
    assert predicate.headers == expected_predicate.headers
Ejemplo n.º 5
0
def test_structure_query():
    expected_predicate = Predicate(query={"key": "value"})
    predicate_structure = expected_predicate.as_structure()
    predicate = Predicate.from_structure(predicate_structure)
    assert predicate.query == expected_predicate.query
Ejemplo n.º 6
0
def test_structure_method():
    expected_predicate = Predicate(method="GET")
    predicate_structure = expected_predicate.as_structure()
    predicate = Predicate.from_structure(predicate_structure)
    assert predicate.method == expected_predicate.method
Ejemplo n.º 7
0
def test_structure_body():
    expected_predicate = Predicate(body="darwin")
    predicate_structure = expected_predicate.as_structure()
    predicate = Predicate.from_structure(predicate_structure)
    assert predicate.body == expected_predicate.body