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 HTTP request tests #7

Open
brendanlong opened this issue Aug 6, 2018 · 1 comment
Open

Add HTTP request tests #7

brendanlong opened this issue Aug 6, 2018 · 1 comment
Labels
enhancement New feature or request testing

Comments

@brendanlong
Copy link
Contributor

Right now our coverage of the actual network sending is lacking. If we had an HTTP server that returns mock data and status codes, we could do something like:

let project = 123 in
let mock_server = Mock_server.make ~path:"/api/123/store" ~return_status:200 in
let port = Mock_server.port mock_server in
let dsn = sprintf "http://key@localhost:%d/123" port in
Sentry.with_dsn dsn (fun () ->
  Sentry.send_capture_message "This is a test");
Sentry.wait_for_queue () (* would need to add this function *)
>>| fun () ->
Mock_server.get_request mock_server
|> [%test_result: Cohttp.Request.t] ~expect
@brendanlong brendanlong added enhancement New feature or request testing labels Aug 6, 2018
@brendanlong
Copy link
Contributor Author

Or maybe it would be easier to just break apart the function that creates HTTP requests and test that..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request testing
Projects
None yet
Development

No branches or pull requests

1 participant