marcoow / rust_rest

MIT License
5 stars 1 forks source link

Add testing #1

Closed marcoow closed 1 year ago

marcoow commented 1 year ago

I have basic DB access and CRUD requests working. Next I'd like to test such that:

marcoow commented 1 year ago

It seems like crates.io is doing something like what I want as well:

https://github.com/rust-lang/crates.io/blob/ea7cc3c3d44faa8055c9f6774b150ae5788276aa/src/tests/categories.rs#L40-L46

I'm not sure where the transaction is rolled back but maybe that's not necessary anyway as that might be automatic once the connection is closed…

marcoow commented 1 year ago

There was a talk on the topic at EuroRust as well: https://www.youtube.com/watch?v=_VB1fLLtZfQ

marcoow commented 1 year ago

The talk suggest using database closing instead of transactions which seems interesting.

marcoow commented 1 year ago

done