sea-orm icon indicating copy to clipboard operation
sea-orm copied to clipboard

[examples] Demonstrate how to mock test SeaORM's CURD operations on common web APIs

Open billy1624 opened this issue 2 years ago • 3 comments

Motivation

Some web API enforce app state to be Clone in particular, Axum, Rocket, etc. However, when mock feature is enabled on SeaORM, it will make DatabaseConnection not cloneable. And this cause trouble for users who want to mock test their web API endpoints.

Proposed Solutions

Separating the API into two standalone crates namely api and core, then we unit test the core and the api is just a wrapper of the core.

Similar to what we did in StarfishQL:

  • core: https://github.com/SeaQL/starfish-ql/tree/main/starfish/starfish-core
  • api: https://github.com/SeaQL/starfish-ql/tree/main/starfish/starfish-api

Additional Information

Related Issues / PRs

  • https://github.com/SeaQL/sea-orm/issues/438
  • https://github.com/SeaQL/sea-orm/pull/665
  • https://github.com/SeaQL/sea-orm/pull/698

billy1624 avatar Jun 30 '22 04:06 billy1624

@tyt2y3 thoughts?

billy1624 avatar Jun 30 '22 04:06 billy1624

Hey @shpun817, would you like to take on this?

billy1624 avatar Jul 14 '22 03:07 billy1624

Hey @shpun817, would you like to take on this?

Okay!

shpun817 avatar Jul 14 '22 03:07 shpun817