Skip to content

Can not check the transaction log of mock database in actix framework #419

Answered by tyt2y3
AndreiOrmanji asked this question in Q&A
Discussion options

You must be logged in to vote

I think so, perhaps you need to add a method to take ownership of the state:

impl AppState {
    pub fn into_database_connection(self) -> DatabaseConnection {
        self.conn
    }
}

That said, I think the general rule of thumb is, you'd refactor the app logic into a business domain module where there is no Actix or any web API dependency.

If you want to test it on app level, you'd probably want to use a real database, or at least, SQLite.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@AndreiOrmanji
Comment options

Answer selected by AndreiOrmanji
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #418 on January 04, 2022 04:39.