def test_or_predicate():
    result = predicates.Or(predicates.Equal({"body": "Nope"}),
                           predicates.Equal({"headers": {
                               "api-key": "yes"
                           }})).as_dict()

    assert "or" in result
    assert "equals" in result["or"][0]
    assert "body" in result["or"][0]["equals"]
    assert "equals" in result["or"][1]
    assert "headers" in result["or"][1]["equals"]
def test_not_predicate():
    result = predicates.Not(predicates.Equal({"body": "Nope"})).as_dict()

    assert "not" in result
    assert "equals" in result["not"]
    assert "Nope" in result["not"]["equals"]["body"]
def test_equal_predicate():
    result = predicates.Equal({"body": "Nope"}).as_dict()

    assert "equals" in result
    assert "body" in result["equals"]
    assert "Nope" in result["equals"]["body"]
Beispiel #4
0
from mountequist import clients, impostors, predicates, responses, servers, stubs

if __name__ == '__main__':
    impostor = impostors.Http(
        stubs.Stub(responses=responses.HttpIs(body="Easy Reply"),
                   predicates=predicates.Equal({
                       "method": "POST",
                       "body": "hmm"
                   })))

    with servers.WindowsServer("C:\\temp\\mountebank-v1.13.0-win-x64"):
        with clients.Http("http://localhost", impostor) as client:
            result_1 = client.post_to_impostor(impostor, data="hmm")
            print(result_1.text)