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

tide-test #273

Closed
wants to merge 80 commits into from
Closed

tide-test #273

wants to merge 80 commits into from

Conversation

yoshuawuyts
Copy link
Member

@yoshuawuyts yoshuawuyts commented Jun 7, 2019

Description

Adds a testing framework for Tide, with an API similar to Node's supertest.

Motivation and Context

This should make it significantly easier to test Tide applications, allowing the authoring of request-like APIs that should be both easy to read, and convenient to write.

How Has This Been Tested?

It hasn't. WIP.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Example

let mut app = tide::App::new();
app.at("/hello").get(async move |_| "Hello, world!");

let mut app = app.test();
let res = app.get("/hello")
    .send()
    .await?;

let body = res
    .assert_status(200)
    .body_string()
    .await?;

assert_eq!(body, String::from("Hello, world!"));

prasannavl and others added 30 commits May 15, 2019 06:51
fix cargo fmt

loosen up clippy to warnings on examples

snipe dev deps from core

eliminate some clippy warnings for examples

add publish false, and remove publish requirements

rename tide-examples to just examples
Fix example link in readme
Rename `serve` to `run`, add asynchronous `serve`
Co-Authored-By: Wonwoo Choi <chwo9843@gmail.com>
Check example in readme compiles during testing
Remove #[allow(unused_mut)]
Middleware-based compression and decompression
Improve curl command consistency
* Move core traits and types to tide-core

* Move cookies middleware to tide-cookies

* Remove unncessary dependencies and use relative paths in README
* Update travis config

 * Separate out individual build jobs for faster wall-clock testing

 * Fix clippy not actually denying warnings (excluded examples because
   these are currently failing and have non-trivial fixes)

 * Add build job that checks --no-default-features works

 * Add build job that checks for intra-doc-resolution failures (excluded
   tide because of bugs in re-exports with the intra-doc feature)

* Fix warnings

* Fix doc-link in tide-cookies
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
fairingrey and others added 26 commits May 21, 2019 07:43
add newline before EOF
Core revamp part 2
pub use ResultDynErrExt in tide::error
…lementation

Also add a bunch of tests that demonstrate the implemented behavior
Fix links in README
Rename Context<Data> to Context<State>
Fix the documentation for wildcards for path definitions to match implementation
Core revamp part 3
Propagate hyper error on serve failure
* doc: Add doc comment to tide-core

* doc: Add documantation to tide-cookie

* doc: Add doc to tide-compression

* doc: Add doc comment

* fix doc links

* fix path

* doc: Add doc comment
* add test that checks for empty body on HEAD req

* update test
currently not working since http-service-mock doesn't exhibit correct behavior yet
* feat: Add cors middleware

* test: Add cors test code

* feat: export CorsMiddleware

* feat: Add cors example

* $cargo fmt

* doc: move example/cors.rs

* doc: Add README

* doc: Add doc comment

* fix example doc comment

* fix: Changed type to option

* feat: Add credentials header at preflight request

* fix: Attach an expose header when requesting preflight

* $cargo fmt

* fix: remove debug pring

* refactor: move build preflight response

* fix: Remove echo_back option

* fix: fix type OPTION -> OPTIONS

* refactor: tide-cors to optional dependence

* $cargo fmt

* refactor: imple arg to generic argument

* fix typo

* refactor: using 'match'
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
src/test.rs Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

None yet