@@ -42,114 +42,6 @@ func TestAction_GetRepoLink(t *testing.T) {
4242	assert .Equal (t , comment .HTMLURL (db .DefaultContext ), action .GetCommentHTMLURL (db .DefaultContext ))
4343}
4444
45- func  TestGetFeeds (t  * testing.T ) {
46- 	// test with an individual user 
47- 	assert .NoError (t , unittest .PrepareTestDatabase ())
48- 	user  :=  unittest .AssertExistsAndLoadBean (t , & user_model.User {ID : 2 })
49- 
50- 	actions , count , err  :=  activities_model .GetFeeds (db .DefaultContext , activities_model.GetFeedsOptions {
51- 		RequestedUser :   user ,
52- 		Actor :           user ,
53- 		IncludePrivate :  true ,
54- 		OnlyPerformedBy : false ,
55- 		IncludeDeleted :  true ,
56- 	})
57- 	assert .NoError (t , err )
58- 	if  assert .Len (t , actions , 1 ) {
59- 		assert .EqualValues (t , 1 , actions [0 ].ID )
60- 		assert .EqualValues (t , user .ID , actions [0 ].UserID )
61- 	}
62- 	assert .Equal (t , int64 (1 ), count )
63- 
64- 	actions , count , err  =  activities_model .GetFeeds (db .DefaultContext , activities_model.GetFeedsOptions {
65- 		RequestedUser :   user ,
66- 		Actor :           user ,
67- 		IncludePrivate :  false ,
68- 		OnlyPerformedBy : false ,
69- 	})
70- 	assert .NoError (t , err )
71- 	assert .Len (t , actions , 0 )
72- 	assert .Equal (t , int64 (0 ), count )
73- }
74- 
75- func  TestGetFeedsForRepos (t  * testing.T ) {
76- 	assert .NoError (t , unittest .PrepareTestDatabase ())
77- 	user  :=  unittest .AssertExistsAndLoadBean (t , & user_model.User {ID : 2 })
78- 	privRepo  :=  unittest .AssertExistsAndLoadBean (t , & repo_model.Repository {ID : 2 })
79- 	pubRepo  :=  unittest .AssertExistsAndLoadBean (t , & repo_model.Repository {ID : 8 })
80- 
81- 	// private repo & no login 
82- 	actions , count , err  :=  activities_model .GetFeeds (db .DefaultContext , activities_model.GetFeedsOptions {
83- 		RequestedRepo :  privRepo ,
84- 		IncludePrivate : true ,
85- 	})
86- 	assert .NoError (t , err )
87- 	assert .Len (t , actions , 0 )
88- 	assert .Equal (t , int64 (0 ), count )
89- 
90- 	// public repo & no login 
91- 	actions , count , err  =  activities_model .GetFeeds (db .DefaultContext , activities_model.GetFeedsOptions {
92- 		RequestedRepo :  pubRepo ,
93- 		IncludePrivate : true ,
94- 	})
95- 	assert .NoError (t , err )
96- 	assert .Len (t , actions , 1 )
97- 	assert .Equal (t , int64 (1 ), count )
98- 
99- 	// private repo and login 
100- 	actions , count , err  =  activities_model .GetFeeds (db .DefaultContext , activities_model.GetFeedsOptions {
101- 		RequestedRepo :  privRepo ,
102- 		IncludePrivate : true ,
103- 		Actor :          user ,
104- 	})
105- 	assert .NoError (t , err )
106- 	assert .Len (t , actions , 1 )
107- 	assert .Equal (t , int64 (1 ), count )
108- 
109- 	// public repo & login 
110- 	actions , count , err  =  activities_model .GetFeeds (db .DefaultContext , activities_model.GetFeedsOptions {
111- 		RequestedRepo :  pubRepo ,
112- 		IncludePrivate : true ,
113- 		Actor :          user ,
114- 	})
115- 	assert .NoError (t , err )
116- 	assert .Len (t , actions , 1 )
117- 	assert .Equal (t , int64 (1 ), count )
118- }
119- 
120- func  TestGetFeeds2 (t  * testing.T ) {
121- 	// test with an organization user 
122- 	assert .NoError (t , unittest .PrepareTestDatabase ())
123- 	org  :=  unittest .AssertExistsAndLoadBean (t , & user_model.User {ID : 3 })
124- 	user  :=  unittest .AssertExistsAndLoadBean (t , & user_model.User {ID : 2 })
125- 
126- 	actions , count , err  :=  activities_model .GetFeeds (db .DefaultContext , activities_model.GetFeedsOptions {
127- 		RequestedUser :   org ,
128- 		Actor :           user ,
129- 		IncludePrivate :  true ,
130- 		OnlyPerformedBy : false ,
131- 		IncludeDeleted :  true ,
132- 	})
133- 	assert .NoError (t , err )
134- 	assert .Len (t , actions , 1 )
135- 	if  assert .Len (t , actions , 1 ) {
136- 		assert .EqualValues (t , 2 , actions [0 ].ID )
137- 		assert .EqualValues (t , org .ID , actions [0 ].UserID )
138- 	}
139- 	assert .Equal (t , int64 (1 ), count )
140- 
141- 	actions , count , err  =  activities_model .GetFeeds (db .DefaultContext , activities_model.GetFeedsOptions {
142- 		RequestedUser :   org ,
143- 		Actor :           user ,
144- 		IncludePrivate :  false ,
145- 		OnlyPerformedBy : false ,
146- 		IncludeDeleted :  true ,
147- 	})
148- 	assert .NoError (t , err )
149- 	assert .Len (t , actions , 0 )
150- 	assert .Equal (t , int64 (0 ), count )
151- }
152- 
15345func  TestActivityReadable (t  * testing.T ) {
15446	tt  :=  []struct  {
15547		desc    string 
@@ -227,26 +119,6 @@ func TestNotifyWatchers(t *testing.T) {
227119	})
228120}
229121
230- func  TestGetFeedsCorrupted (t  * testing.T ) {
231- 	// Now we will not check for corrupted data in the feeds 
232- 	// users should run doctor to fix their data 
233- 	assert .NoError (t , unittest .PrepareTestDatabase ())
234- 	user  :=  unittest .AssertExistsAndLoadBean (t , & user_model.User {ID : 1 })
235- 	unittest .AssertExistsAndLoadBean (t , & activities_model.Action {
236- 		ID :     8 ,
237- 		RepoID : 1700 ,
238- 	})
239- 
240- 	actions , count , err  :=  activities_model .GetFeeds (db .DefaultContext , activities_model.GetFeedsOptions {
241- 		RequestedUser :  user ,
242- 		Actor :          user ,
243- 		IncludePrivate : true ,
244- 	})
245- 	assert .NoError (t , err )
246- 	assert .Len (t , actions , 1 )
247- 	assert .Equal (t , int64 (1 ), count )
248- }
249- 
250122func  TestConsistencyUpdateAction (t  * testing.T ) {
251123	if  ! setting .Database .Type .IsSQLite3 () {
252124		t .Skip ("Test is only for SQLite database." )
@@ -256,7 +128,7 @@ func TestConsistencyUpdateAction(t *testing.T) {
256128	unittest .AssertExistsAndLoadBean (t , & activities_model.Action {
257129		ID : int64 (id ),
258130	})
259- 	_ , err  :=  db .GetEngine (db .DefaultContext ).Exec (`UPDATE action SET created_unix = ""  WHERE id = ?` , id )
131+ 	_ , err  :=  db .GetEngine (db .DefaultContext ).Exec (`UPDATE action SET created_unix = ''  WHERE id = ?` , id )
260132	assert .NoError (t , err )
261133	actions  :=  make ([]* activities_model.Action , 0 , 1 )
262134	// 
@@ -322,24 +194,3 @@ func TestDeleteIssueActions(t *testing.T) {
322194	assert .NoError (t , activities_model .DeleteIssueActions (db .DefaultContext , issue .RepoID , issue .ID , issue .Index ))
323195	unittest .AssertCount (t , & activities_model.Action {}, 0 )
324196}
325- 
326- func  TestRepoActions (t  * testing.T ) {
327- 	assert .NoError (t , unittest .PrepareTestDatabase ())
328- 	repo  :=  unittest .AssertExistsAndLoadBean (t , & repo_model.Repository {ID : 1 })
329- 	_  =  db .TruncateBeans (db .DefaultContext , & activities_model.Action {})
330- 	for  i  :=  0 ; i  <  3 ; i ++  {
331- 		_  =  db .Insert (db .DefaultContext , & activities_model.Action {
332- 			UserID :    2  +  int64 (i ),
333- 			ActUserID : 2 ,
334- 			RepoID :    repo .ID ,
335- 			OpType :    activities_model .ActionCommentIssue ,
336- 		})
337- 	}
338- 	count , _  :=  db .Count [activities_model.Action ](db .DefaultContext , & db.ListOptions {})
339- 	assert .EqualValues (t , 3 , count )
340- 	actions , _ , err  :=  activities_model .GetFeeds (db .DefaultContext , activities_model.GetFeedsOptions {
341- 		RequestedRepo : repo ,
342- 	})
343- 	assert .NoError (t , err )
344- 	assert .Len (t , actions , 1 )
345- }
0 commit comments