@@ -22,7 +22,11 @@ func TestUpdateUser(t *testing.T) {
22
22
admin := unittest .AssertExistsAndLoadBean (t , & user_model.User {ID : 1 })
23
23
24
24
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 ),
26
30
}))
27
31
28
32
user := unittest .AssertExistsAndLoadBean (t , & user_model.User {ID : 28 })
@@ -38,7 +42,7 @@ func TestUpdateUser(t *testing.T) {
38
42
MaxRepoCreation : optional .Some (10 ),
39
43
IsRestricted : optional .Some (true ),
40
44
IsActive : optional .Some (false ),
41
- IsAdmin : optional . Some (true ),
45
+ IsAdmin : UpdateOptionFieldFromValue (true ),
42
46
Visibility : optional .Some (structs .VisibleTypePrivate ),
43
47
KeepActivityPrivate : optional .Some (true ),
44
48
Language : optional .Some ("lang" ),
@@ -60,7 +64,7 @@ func TestUpdateUser(t *testing.T) {
60
64
assert .Equal (t , opts .MaxRepoCreation .Value (), user .MaxRepoCreation )
61
65
assert .Equal (t , opts .IsRestricted .Value (), user .IsRestricted )
62
66
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 )
64
68
assert .Equal (t , opts .Visibility .Value (), user .Visibility )
65
69
assert .Equal (t , opts .KeepActivityPrivate .Value (), user .KeepActivityPrivate )
66
70
assert .Equal (t , opts .Language .Value (), user .Language )
@@ -80,7 +84,7 @@ func TestUpdateUser(t *testing.T) {
80
84
assert .Equal (t , opts .MaxRepoCreation .Value (), user .MaxRepoCreation )
81
85
assert .Equal (t , opts .IsRestricted .Value (), user .IsRestricted )
82
86
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 )
84
88
assert .Equal (t , opts .Visibility .Value (), user .Visibility )
85
89
assert .Equal (t , opts .KeepActivityPrivate .Value (), user .KeepActivityPrivate )
86
90
assert .Equal (t , opts .Language .Value (), user .Language )
0 commit comments