33// license that can be found in the LICENSE file.
44// SPDX-License-Identifier: MIT
55
6- package orgtime_test
6+ package organization_test
77
88import (
9- "path/filepath"
109 "testing"
1110
1211 "code.gitea.io/gitea/models/db"
@@ -18,21 +17,6 @@ import (
1817 "github.com/stretchr/testify/assert"
1918)
2019
21- // TestMain sets up the testing environment specifically for testing org times.
22- func TestMain (m * testing.M ) {
23- unittest .MainTest (m , & unittest.TestOptions {
24- GiteaRootPath : filepath .Join (".." , ".." , ".." ),
25- FixtureFiles : []string {
26- "user.yml" ,
27- "org_user.yml" ,
28- "repository.yml" ,
29- "issue.yml" ,
30- "milestone.yml" ,
31- "tracked_time.yml" ,
32- },
33- })
34- }
35-
3620// TestTimesPrepareDB prepares the database for the following tests.
3721func TestTimesPrepareDB (t * testing.T ) {
3822 assert .NoError (t , unittest .PrepareTestDatabase ())
@@ -113,7 +97,7 @@ func TestTimesByRepos(t *testing.T) {
11397 t .Run (kase .name , func (t * testing.T ) {
11498 org , err := organization .GetOrgByID (db .DefaultContext , kase .orgname )
11599 assert .NoError (t , err )
116- results , err := org .GetTimesByRepos (kase .unixfrom , kase .unixto )
100+ results , err := organization .GetTimesByRepos (org , kase .unixfrom , kase .unixto )
117101 assert .NoError (t , err )
118102 assert .Equal (t , kase .expected , results )
119103 })
@@ -217,7 +201,7 @@ func TestTimesByMilestones(t *testing.T) {
217201 t .Run (kase .name , func (t * testing.T ) {
218202 org , err := organization .GetOrgByID (db .DefaultContext , kase .orgname )
219203 assert .NoError (t , err )
220- results , err := org .GetTimesByMilestones (kase .unixfrom , kase .unixto )
204+ results , err := organization .GetTimesByMilestones (org , kase .unixfrom , kase .unixto )
221205 assert .NoError (t , err )
222206 assert .Equal (t , kase .expected , results )
223207 })
@@ -300,7 +284,7 @@ func TestTimesByMembers(t *testing.T) {
300284 t .Run (kase .name , func (t * testing.T ) {
301285 org , err := organization .GetOrgByID (db .DefaultContext , kase .orgname )
302286 assert .NoError (t , err )
303- results , err := org .GetTimesByMembers (kase .unixfrom , kase .unixto )
287+ results , err := organization .GetTimesByMembers (org , kase .unixfrom , kase .unixto )
304288 assert .NoError (t , err )
305289 assert .Equal (t , kase .expected , results )
306290 })
0 commit comments