@@ -22,7 +22,11 @@ func TestUpdateUser(t *testing.T) {
2222 admin := unittest .AssertExistsAndLoadBean (t , & user_model.User {ID : 1 })
2323
2424 assert .Error (t , UpdateUser (db .DefaultContext , admin , & UpdateOptions {
25- IsAdmin : optional .Some (false ),
25+ IsAdmin : UpdateOptionFieldFromValue (false ),
26+ }))
27+
28+ assert .NoError (t , UpdateUser (db .DefaultContext , admin , & UpdateOptions {
29+ IsAdmin : UpdateOptionFieldFromSync (false ),
2630 }))
2731
2832 user := unittest .AssertExistsAndLoadBean (t , & user_model.User {ID : 28 })
@@ -38,7 +42,7 @@ func TestUpdateUser(t *testing.T) {
3842 MaxRepoCreation : optional .Some (10 ),
3943 IsRestricted : optional .Some (true ),
4044 IsActive : optional .Some (false ),
41- IsAdmin : optional . Some (true ),
45+ IsAdmin : UpdateOptionFieldFromValue (true ),
4246 Visibility : optional .Some (structs .VisibleTypePrivate ),
4347 KeepActivityPrivate : optional .Some (true ),
4448 Language : optional .Some ("lang" ),
@@ -60,7 +64,7 @@ func TestUpdateUser(t *testing.T) {
6064 assert .Equal (t , opts .MaxRepoCreation .Value (), user .MaxRepoCreation )
6165 assert .Equal (t , opts .IsRestricted .Value (), user .IsRestricted )
6266 assert .Equal (t , opts .IsActive .Value (), user .IsActive )
63- assert .Equal (t , opts .IsAdmin .Value (), user .IsAdmin )
67+ assert .Equal (t , opts .IsAdmin .Value (). FieldValue , user .IsAdmin )
6468 assert .Equal (t , opts .Visibility .Value (), user .Visibility )
6569 assert .Equal (t , opts .KeepActivityPrivate .Value (), user .KeepActivityPrivate )
6670 assert .Equal (t , opts .Language .Value (), user .Language )
@@ -80,7 +84,7 @@ func TestUpdateUser(t *testing.T) {
8084 assert .Equal (t , opts .MaxRepoCreation .Value (), user .MaxRepoCreation )
8185 assert .Equal (t , opts .IsRestricted .Value (), user .IsRestricted )
8286 assert .Equal (t , opts .IsActive .Value (), user .IsActive )
83- assert .Equal (t , opts .IsAdmin .Value (), user .IsAdmin )
87+ assert .Equal (t , opts .IsAdmin .Value (). FieldValue , user .IsAdmin )
8488 assert .Equal (t , opts .Visibility .Value (), user .Visibility )
8589 assert .Equal (t , opts .KeepActivityPrivate .Value (), user .KeepActivityPrivate )
8690 assert .Equal (t , opts .Language .Value (), user .Language )
0 commit comments