Commit 800d9c6 1 parent cf6ebac commit 800d9c6 Copy full SHA for 800d9c6
File tree 2 files changed +9
-10
lines changed
2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ $ cargo run -- runserver
32
32
33
33
## Tests
34
34
35
- In order to run tests, you need to have a postgresql database running.
35
+ In order to run tests, you need to have a postgresql database and redis running.
36
36
37
37
To avoid thread conflicts while accessing the database, use the ` --test-threads=1 ` option.
38
38
Original file line number Diff line number Diff line change @@ -717,28 +717,27 @@ mod tests {
717
717
async fn test_electrical_profile_set_delete (
718
718
#[ future] electrical_profile_set : TestFixture < ElectricalProfileSet > ,
719
719
) {
720
+ // GIVEN
720
721
let pg_config = PostgresConfig :: default ( ) ;
721
722
let electrical_profile_set = electrical_profile_set. await ;
722
723
723
- let mut conn = PgConnection :: establish ( & pg_config. url ( ) ) . await . unwrap ( ) ;
724
- let previous_length = ElectricalProfileSet :: list_light ( & mut conn)
725
- . await
726
- . unwrap ( )
727
- . len ( ) ;
728
-
729
724
let args = DeleteProfileSetArgs {
730
725
profile_set_ids : vec ! [ electrical_profile_set. id( ) ] ,
731
726
} ;
727
+
728
+ // WHEN
732
729
electrical_profile_set_delete ( args, pg_config. clone ( ) )
733
730
. await
734
731
. unwrap ( ) ;
735
732
733
+ // THEN
736
734
let mut conn = PgConnection :: establish ( & pg_config. url ( ) ) . await . unwrap ( ) ;
737
- let new_length = ElectricalProfileSet :: list_light ( & mut conn)
735
+ let empty = ! ElectricalProfileSet :: list_light ( & mut conn)
738
736
. await
739
737
. unwrap ( )
740
- . len ( ) ;
741
- assert_eq ! ( new_length, previous_length - 1 ) ;
738
+ . iter ( )
739
+ . any ( |eps| eps. id == electrical_profile_set. id ( ) ) ;
740
+ assert ! ( empty) ;
742
741
}
743
742
744
743
#[ rstest]
You can’t perform that action at this time.
0 commit comments