@@ -13,29 +13,33 @@ func (suite *MethodTestSuite) TestAPIKey() {
13
13
suite .Run ("DeleteAPIKeyByID" , func () {
14
14
suite .RunMethodTest (func (t * testing.T , db database.Store ) MethodCase {
15
15
key , _ := dbgen .APIKey (t , db , database.APIKey {})
16
- return methodCase (values (key .ID ), asserts (key , rbac .ActionDelete ))
16
+ return methodCase (values (key .ID ), asserts (key , rbac .ActionDelete ), values () )
17
17
})
18
18
})
19
19
suite .Run ("GetAPIKeyByID" , func () {
20
20
suite .RunMethodTest (func (t * testing.T , db database.Store ) MethodCase {
21
21
key , _ := dbgen .APIKey (t , db , database.APIKey {})
22
- return methodCase (values (key .ID ), asserts (key , rbac .ActionRead ))
22
+ return methodCase (values (key .ID ), asserts (key , rbac .ActionRead ), values ( key ) )
23
23
})
24
24
})
25
25
suite .Run ("GetAPIKeysByLoginType" , func () {
26
26
suite .RunMethodTest (func (t * testing.T , db database.Store ) MethodCase {
27
27
a , _ := dbgen .APIKey (t , db , database.APIKey {LoginType : database .LoginTypePassword })
28
28
b , _ := dbgen .APIKey (t , db , database.APIKey {LoginType : database .LoginTypePassword })
29
29
_ , _ = dbgen .APIKey (t , db , database.APIKey {LoginType : database .LoginTypeGithub })
30
- return methodCase (values (database .LoginTypePassword ), asserts (a , rbac .ActionRead , b , rbac .ActionRead ))
30
+ return methodCase (values (database .LoginTypePassword ),
31
+ asserts (a , rbac .ActionRead , b , rbac .ActionRead ),
32
+ values ([]database.APIKey {a , b }))
31
33
})
32
34
})
33
35
suite .Run ("GetAPIKeysLastUsedAfter" , func () {
34
36
suite .RunMethodTest (func (t * testing.T , db database.Store ) MethodCase {
35
37
a , _ := dbgen .APIKey (t , db , database.APIKey {LastUsed : time .Now ().Add (time .Hour )})
36
38
b , _ := dbgen .APIKey (t , db , database.APIKey {LastUsed : time .Now ().Add (time .Hour )})
37
39
_ , _ = dbgen .APIKey (t , db , database.APIKey {LastUsed : time .Now ().Add (- time .Hour )})
38
- return methodCase (values (time .Now ()), asserts (a , rbac .ActionRead , b , rbac .ActionRead ))
40
+ return methodCase (values (time .Now ()),
41
+ asserts (a , rbac .ActionRead , b , rbac .ActionRead ),
42
+ values ([]database.APIKey {a , b }))
39
43
})
40
44
})
41
45
suite .Run ("InsertAPIKey" , func () {
@@ -45,16 +49,16 @@ func (suite *MethodTestSuite) TestAPIKey() {
45
49
UserID : u .ID ,
46
50
LoginType : database .LoginTypePassword ,
47
51
Scope : database .APIKeyScopeAll ,
48
- }), asserts (rbac .ResourceAPIKey .WithOwner (u .ID .String ()), rbac .ActionCreate ))
52
+ }), asserts (rbac .ResourceAPIKey .WithOwner (u .ID .String ()), rbac .ActionCreate ),
53
+ values ())
49
54
})
50
55
})
51
56
suite .Run ("UpdateAPIKeyByID" , func () {
52
57
suite .RunMethodTest (func (t * testing.T , db database.Store ) MethodCase {
53
58
a , _ := dbgen .APIKey (t , db , database.APIKey {})
54
59
return methodCase (values (database.UpdateAPIKeyByIDParams {
55
- ID : a .ID ,
56
- LastUsed : time .Now (),
57
- }), asserts (a , rbac .ActionUpdate ))
60
+ ID : a .ID ,
61
+ }), asserts (a , rbac .ActionUpdate ), values (a ))
58
62
})
59
63
})
60
64
}
0 commit comments