@@ -50,21 +50,21 @@ func CheckConsistencyFor(t *testing.T, beansToCheck ...interface{}) {
50
50
func checkForConsistency (bean interface {}, t * testing.T ) {
51
51
switch b := bean .(type ) {
52
52
case * User :
53
- checkForConsistencyUser (b , t )
53
+ checkForUserConsistency (b , t )
54
54
case * Repository :
55
- checkForConsistencyRepo (b , t )
55
+ checkForRepoConsistency (b , t )
56
56
case * Issue :
57
- checkForConsistencyIssue (b , t )
57
+ checkForIssueConsistency (b , t )
58
58
case * PullRequest :
59
- checkForConsistencyPullRequest (b , t )
59
+ checkForPullRequestConsistency (b , t )
60
60
case * Milestone :
61
- checkForConsistencyMilestone (b , t )
61
+ checkForMilestoneConsistency (b , t )
62
62
case * Label :
63
- checkForConsistencyLabel (b , t )
63
+ checkForLabelConsistency (b , t )
64
64
case * Team :
65
- checkForConsistencyTeam (b , t )
65
+ checkForTeamConsistency (b , t )
66
66
case * Action :
67
- checkForConsistencyAction (b , t )
67
+ checkForActionConsistency (b , t )
68
68
default :
69
69
t .Errorf ("unknow bean type: %#v" , bean )
70
70
}
@@ -83,7 +83,7 @@ func assertCount(t *testing.T, bean interface{}, expected int) {
83
83
"Failed consistency test, the counted bean (of type %T) was %+v" , bean , bean )
84
84
}
85
85
86
- func checkForConsistencyUser (user * User , t * testing.T ) {
86
+ func checkForUserConsistency (user * User , t * testing.T ) {
87
87
assertCount (t , & Repository {OwnerID : user .ID }, user .NumRepos )
88
88
assertCount (t , & Star {UID : user .ID }, user .NumStars )
89
89
assertCount (t , & OrgUser {OrgID : user .ID }, user .NumMembers )
@@ -96,7 +96,7 @@ func checkForConsistencyUser(user *User, t *testing.T) {
96
96
}
97
97
}
98
98
99
- func checkForConsistencyRepo (repo * Repository , t * testing.T ) {
99
+ func checkForRepoConsistency (repo * Repository , t * testing.T ) {
100
100
assert .Equal (t , repo .LowerName , strings .ToLower (repo .Name ), "repo: %+v" , repo )
101
101
assertCount (t , & Star {RepoID : repo .ID }, repo .NumStars )
102
102
assertCount (t , & Milestone {RepoID : repo .ID }, repo .NumMilestones )
@@ -130,7 +130,7 @@ func checkForConsistencyRepo(repo *Repository, t *testing.T) {
130
130
"Unexpected number of closed milestones for repo %+v" , repo )
131
131
}
132
132
133
- func checkForConsistencyIssue (issue * Issue , t * testing.T ) {
133
+ func checkForIssueConsistency (issue * Issue , t * testing.T ) {
134
134
actual := getCount (t , db .GetEngine (db .DefaultContext ).Where ("type=?" , CommentTypeComment ), & Comment {IssueID : issue .ID })
135
135
assert .EqualValues (t , issue .NumComments , actual ,
136
136
"Unexpected number of comments for issue %+v" , issue )
@@ -140,13 +140,13 @@ func checkForConsistencyIssue(issue *Issue, t *testing.T) {
140
140
}
141
141
}
142
142
143
- func checkForConsistencyPullRequest (pr * PullRequest , t * testing.T ) {
143
+ func checkForPullRequestConsistency (pr * PullRequest , t * testing.T ) {
144
144
issue := db .AssertExistsAndLoadBean (t , & Issue {ID : pr .IssueID }).(* Issue )
145
145
assert .True (t , issue .IsPull )
146
146
assert .EqualValues (t , issue .Index , pr .Index )
147
147
}
148
148
149
- func checkForConsistencyMilestone (milestone * Milestone , t * testing.T ) {
149
+ func checkForMilestoneConsistency (milestone * Milestone , t * testing.T ) {
150
150
assertCount (t , & Issue {MilestoneID : milestone .ID }, milestone .NumIssues )
151
151
152
152
actual := getCount (t , db .GetEngine (db .DefaultContext ).Where ("is_closed=?" , true ), & Issue {MilestoneID : milestone .ID })
@@ -160,7 +160,7 @@ func checkForConsistencyMilestone(milestone *Milestone, t *testing.T) {
160
160
assert .Equal (t , completeness , milestone .Completeness )
161
161
}
162
162
163
- func checkForConsistencyLabel (label * Label , t * testing.T ) {
163
+ func checkForLabelConsistency (label * Label , t * testing.T ) {
164
164
issueLabels := make ([]* IssueLabel , 0 , 10 )
165
165
assert .NoError (t , db .GetEngine (db .DefaultContext ).Find (& issueLabels , & IssueLabel {LabelID : label .ID }))
166
166
assert .EqualValues (t , label .NumIssues , len (issueLabels ),
@@ -179,12 +179,12 @@ func checkForConsistencyLabel(label *Label, t *testing.T) {
179
179
"Unexpected number of closed issues for label %+v" , label )
180
180
}
181
181
182
- func checkForConsistencyTeam (team * Team , t * testing.T ) {
182
+ func checkForTeamConsistency (team * Team , t * testing.T ) {
183
183
assertCount (t , & TeamUser {TeamID : team .ID }, team .NumMembers )
184
184
assertCount (t , & TeamRepo {TeamID : team .ID }, team .NumRepos )
185
185
}
186
186
187
- func checkForConsistencyAction (action * Action , t * testing.T ) {
187
+ func checkForActionConsistency (action * Action , t * testing.T ) {
188
188
repo := db .AssertExistsAndLoadBean (t , & Repository {ID : action .RepoID }).(* Repository )
189
189
assert .Equal (t , repo .IsPrivate , action .IsPrivate , "action: %+v" , action )
190
190
}
0 commit comments