@@ -6,7 +6,7 @@ use postgres_types::{to_sql_checked, FromSql, IsNull, ToSql, Type};
6
6
use std:: collections:: HashMap ;
7
7
use std:: error:: Error ;
8
8
9
- #[ derive( Debug , Default , Copy , Clone ) ]
9
+ #[ derive( Debug , Default , Copy , Clone , PartialEq ) ]
10
10
pub enum RotationMode {
11
11
/// The reviewer can be automatically assigned by triagebot,
12
12
/// and they can be assigned through teams and assign groups.
@@ -243,4 +243,26 @@ mod tests {
243
243
} )
244
244
. await ;
245
245
}
246
+
247
+ #[ tokio:: test]
248
+ async fn set_rotation_mode ( ) {
249
+ run_db_test ( |ctx| async {
250
+ let db = ctx. db_client ( ) ;
251
+ let user = user ( "Martin" , 1 ) ;
252
+
253
+ upsert_review_prefs ( & db, user. clone ( ) , Some ( 5 ) , RotationMode :: OnRotation ) . await ?;
254
+ assert_eq ! (
255
+ get_review_prefs( & db, 1 ) . await ?. unwrap( ) . rotation_mode,
256
+ RotationMode :: OnRotation
257
+ ) ;
258
+ upsert_review_prefs ( & db, user. clone ( ) , Some ( 10 ) , RotationMode :: OffRotation ) . await ?;
259
+ assert_eq ! (
260
+ get_review_prefs( & db, 1 ) . await ?. unwrap( ) . rotation_mode,
261
+ RotationMode :: OffRotation
262
+ ) ;
263
+
264
+ Ok ( ctx)
265
+ } )
266
+ . await ;
267
+ }
246
268
}
0 commit comments