Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add high-level expectations #3

Open
PiotrSikora opened this issue Aug 11, 2020 · 2 comments
Open

Add high-level expectations #3

PiotrSikora opened this issue Aug 11, 2020 · 2 comments

Comments

@PiotrSikora
Copy link
Member

PiotrSikora commented Aug 11, 2020

Provide high-level expectations, e.g.:

http_headers_test
    .http_request(vec![
            (":method", "GET"),
            (":path", "/hello"),
            (":authority", "developer"),
        ],
        None, // request body
        None, // request trailers
    )
    .expect_log(LogLevel::Trace, "#1 -> :method: GET")
    .expect_log(LogLevel::Trace, "#1 -> :path: /hello")
    .expect_log(LogLevel::Trace, "#1 -> :authority: developer")
    .execute_and_expect(ReturnType::Action(Action::Continue))?;

which would be more or less equivalent to this test expressed using currently available low-level expectations:

http_headers_test
    .call_start()
    .execute_and_expect(ReturnType::None)?;

let root_context = 1;
http_headers_test
    .call_proxy_on_context_create(root_context, 0)
    .execute_and_expect(ReturnType::None)?;

let http_context = 2;
http_headers_test
    .call_proxy_on_context_create(http_context, root_context)
    .execute_and_expect(ReturnType::None)?;

http_headers_test
    .call_proxy_on_request_headers(http_context, 0)
    .expect_get_header_map_pairs(MapType::HttpRequestHeaders)
    .returning(vec![
        (":method", "GET"),
            (":path", "/hello"),
            (":authority", "developer"),
        ])
    .expect_log(LogLevel::Trace, "#1 -> :method: GET")
    .expect_log(LogLevel::Trace, "#1 -> :path: /hello")
    .expect_log(LogLevel::Trace, "#1 -> :authority: developer")
    .execute_and_expect(ReturnType::Action(Action::Continue))?;
@PiotrSikora
Copy link
Member Author

cc @agiachris

@agiachris
Copy link
Contributor

Yes, this is on the TODO for next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants