Open hunts opened 1 year ago
Hi @sfackler ,
I usually create a struct and implement TryFrom<Row>
for that struct, I rely on integration tests(which are usually more expensive) to test end to end.
Do you have any recommendation how to unit test conversions? Thank you.
I, too, need something like this for unit testing. @sfackler Any thoughts on accepting this or something similar?
I also need this, been watching the pr for a while, but seems like it's not going to be merged at all?
Nothing to add except that the ability to synthesize Rows / a RowStream in unit testing is still very important to me.
Is this something we can expect to ever see in rust-postgres
or no?
@sfackler can you let us know if you're considering this PR at all or if we have to build around it some other way to be able to get our unit test coverage up.
Added RowDescription trait, and let rows to share the same description rather than having a copy in each row (think when there are thousand of them in the result).
Added RowBuilder to support adding stubs of row data in unit tests.
Currently, the library users have no chooice but have to use integration tests for testing Postgres data access code. With the changes in this commit, the
tokio-postgres
lib users can use RowBuilder to create sutbs to verify the deserialization from database result (Rows) to custom stucts in unit tests.It can also serves as a base for future implementation of certain kind of mocks of the db connection.
Related-to #910 #950