()
| 3 | |
| 4 | #[cfg(feature = "mock")] |
| 5 | pub fn prepare_mock_db() -> DatabaseConnection { |
| 6 | MockDatabase::new(DatabaseBackend::Postgres) |
| 7 | .append_query_results([ |
| 8 | [post::Model { |
| 9 | id: 1, |
| 10 | title: "Title A".to_owned(), |
| 11 | text: "Text A".to_owned(), |
| 12 | }], |
| 13 | [post::Model { |
| 14 | id: 5, |
| 15 | title: "Title C".to_owned(), |
| 16 | text: "Text C".to_owned(), |
| 17 | }], |
| 18 | [post::Model { |
| 19 | id: 6, |
| 20 | title: "Title D".to_owned(), |
| 21 | text: "Text D".to_owned(), |
| 22 | }], |
| 23 | [post::Model { |
| 24 | id: 1, |
| 25 | title: "Title A".to_owned(), |
| 26 | text: "Text A".to_owned(), |
| 27 | }], |
| 28 | [post::Model { |
| 29 | id: 1, |
| 30 | title: "New Title A".to_owned(), |
| 31 | text: "New Text A".to_owned(), |
| 32 | }], |
| 33 | [post::Model { |
| 34 | id: 5, |
| 35 | title: "Title C".to_owned(), |
| 36 | text: "Text C".to_owned(), |
| 37 | }], |
| 38 | ]) |
| 39 | .append_exec_results([ |
| 40 | MockExecResult { |
| 41 | last_insert_id: 6, |
| 42 | rows_affected: 1, |
| 43 | }, |
| 44 | MockExecResult { |
| 45 | last_insert_id: 6, |
| 46 | rows_affected: 5, |
| 47 | }, |
| 48 | ]) |
| 49 | .into_connection() |
| 50 | } |
no test coverage detected