Changeset - e6224a7c3d4e
[Not reviewed]
default
0 2 1
FUJIWARA Katsunori - 9 years ago 2017-01-22 18:17:38
foozy@lares.dti.ne.jp
tests: introduce more test coverage of whoosh filtering

This has been extracted from other changesets by Mads Kiilerich to establish a
test baseline so we clearly can see what the following fixes are fixing.

Some of these tests will thus demonstrate bad behaviour - that will be fixed
later.
3 files changed with 262 insertions and 16 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/fixtures/journal_dump.csv
Show inline comments
 
@@ -1844,192 +1844,194 @@ user_log_id,user_id,username,repository_
 
1907,3,demo,381,test01012145,"",push_local:225a9898957de5f78ac2aa8e4d46a80eed3ee6d5,2012-11-16 13:04:53.384353
 
1908,3,demo,382,aaa-repo-fork,"",started_following_repo,2012-11-17 12:58:42.919876
 
1909,3,demo,67,group/aaa-repo,"",user_forked_repo:aaa-repo-fork,2012-11-17 12:58:42.981111
 
1910,3,demo,382,aaa-repo-fork,"",user_created_fork:aaa-repo-fork,2012-11-17 12:58:42.992071
 
1911,3,demo,382,aaa-repo-fork,"",user_updated_repo,2012-11-17 12:59:32.084662
 
1912,2,admin,,"","",admin_updated_user:kiall,2012-11-17 21:52:15.776253
 
1913,3,demo,268,foofootest,"",user_commented_revision:4bc0645c20363db85c9a5050a85c2c05a1991765,2012-11-20 12:19:44.614295
 
1914,3,demo,383,aaa-test-repo,"",started_following_repo,2012-11-20 12:27:16.120325
 
1915,3,demo,383,aaa-test-repo,"",user_created_repo,2012-11-20 12:27:16.130553
 
1916,3,demo,383,aaa-test-repo,"",push_local:fb2f5ae9a806abe4cb03fe7b11d4ad21a836f7b6,2012-11-20 12:27:41.98988
 
1917,3,demo,384,aaa-test-repo2,"",started_following_repo,2012-11-20 12:31:43.009679
 
1918,3,demo,384,aaa-test-repo2,"",user_created_repo,2012-11-20 12:31:43.019015
 
1919,3,demo,384,aaa-test-repo2,"",push_local:83a7be8f9d651912ee343067bd392678fbebe3e8,2012-11-20 12:32:34.336741
 
1920,3,demo,385,aaa-test-repo2-fork,"",started_following_repo,2012-11-20 12:58:25.715274
 
1921,3,demo,384,aaa-test-repo2,"",user_forked_repo:aaa-test-repo2-fork,2012-11-20 12:58:25.729374
 
1922,3,demo,385,aaa-test-repo2-fork,"",user_created_fork:aaa-test-repo2-fork,2012-11-20 12:58:25.737204
 
1923,3,demo,385,aaa-test-repo2-fork,"",push_local:af794c0c7cf39be92c6b59bb8b7871d313b1d248,2012-11-20 12:58:59.668087
 
1924,3,demo,384,aaa-test-repo2,"",user_commented_pull_request:74,2012-11-20 13:25:32.773937
 
1925,3,demo,384,aaa-test-repo2,"",user_commented_pull_request:74,2012-11-20 13:33:39.823854
 
1926,3,demo,384,aaa-test-repo2,"",user_closed_pull_request:74,2012-11-20 13:33:39.828583
 
1927,3,demo,385,aaa-test-repo2-fork,"",push_local:67120aaf6ddd81cd2aabde6adc22e7ca90d15d12,2012-11-20 18:41:48.280705
 
1928,3,demo,384,aaa-test-repo2,81.178.131.20,"push:af794c0c7cf39be92c6b59bb8b7871d313b1d248,67120aaf6ddd81cd2aabde6adc22e7ca90d15d12",2012-11-20 20:01:34.101349
 
1929,3,demo,385,aaa-test-repo2-fork,"",push_local:5ece07f12c61645049e7d2d3d33797942b16cba5,2012-11-20 20:10:49.816215
 
1930,3,demo,385,aaa-test-repo2-fork,"",push_local:fd8a6936e27e3c31684155790f78effb33e6cc5c,2012-11-20 20:24:06.305599
 
1931,3,demo,384,aaa-test-repo2,81.178.131.20,push:5ece07f12c61645049e7d2d3d33797942b16cba5,2012-11-20 20:49:00.180794
 
1932,3,demo,384,aaa-test-repo2,81.178.131.20,push:fd8a6936e27e3c31684155790f78effb33e6cc5c,2012-11-20 21:28:16.281326
 
1933,3,demo,384,aaa-test-repo2,"",user_commented_pull_request:75,2012-11-21 01:38:22.165876
 
1934,3,demo,384,aaa-test-repo2,"",user_closed_pull_request:75,2012-11-21 01:38:22.175975
 
1935,3,demo,385,aaa-test-repo2-fork,"",push_local:586be5737b6b185d37ab249e028470417698b44d,2012-11-21 01:42:21.540009
 
1936,3,demo,385,aaa-test-repo2-fork,"",push_local:b836457cf5b358555c26193e67770d56e2345f4c,2012-11-21 01:50:03.178941
 
1937,3,demo,384,aaa-test-repo2,81.178.131.20,"push:586be5737b6b185d37ab249e028470417698b44d,b836457cf5b358555c26193e67770d56e2345f4c",2012-11-21 02:01:01.40853
 
1938,3,demo,34,a-very-long-usper-loooong-name-that-is-to-long,"",push_local:ff712eae5a99bede2bf710d86f86b0b534fbf089,2012-11-21 02:09:50.150788
 
1939,3,demo,68,aaa-project,"",user_commented_revision:b4bf1f77b1288a24eb395537319b4f3155cffa71,2012-11-21 08:36:43.456525
 
1940,3,demo,384,aaa-test-repo2,"",user_commented_revision:b836457cf5b358555c26193e67770d56e2345f4c,2012-11-21 12:03:06.317362
 
1941,3,demo,385,aaa-test-repo2-fork,"",push_local:d38a759ba1f79489db44854c9ddf06986f7e2b72,2012-11-21 12:17:04.303085
 
1942,3,demo,385,aaa-test-repo2-fork,"",user_commented_revision:d38a759ba1f79489db44854c9ddf06986f7e2b72,2012-11-21 12:17:47.536221
 
1943,3,demo,34,a-very-long-usper-loooong-name-that-is-to-long,"",user_commented_revision:f437e821a406d35b1e231c5a81e82853f8ed6436,2012-11-21 14:27:15.134067
 
1944,3,demo,386,I-am-a-very-long-repository-name-fork,"",started_following_repo,2012-11-21 15:31:17.25368
 
1945,3,demo,348,group/I-am-a-very-long-repository-name,"",user_forked_repo:I-am-a-very-long-repository-name-fork,2012-11-21 15:31:17.271794
 
1946,3,demo,386,I-am-a-very-long-repository-name-fork,"",user_created_fork:I-am-a-very-long-repository-name-fork,2012-11-21 15:31:17.283533
 
1947,3,demo,385,aaa-test-repo2-fork,"",user_commented_revision:d38a759ba1f79489db44854c9ddf06986f7e2b72,2012-11-21 16:35:17.484282
 
1948,3,demo,385,aaa-test-repo2-fork,"",push_local:96abb74e8e96a81a7dc5d472c70158da5318a623,2012-11-21 16:35:50.796373
 
1949,3,demo,385,aaa-test-repo2-fork,"",user_commented_revision:96abb74e8e96a81a7dc5d472c70158da5318a623,2012-11-21 16:36:25.797019
 
1950,2,admin,68,aaa-project,"",push_local:7db38281c68497cee8dc4510d77e03fbb4d6c395,2012-11-21 18:34:44.97296
 
1951,2,admin,68,aaa-project,"",push_local:de5af01cc0f75ab84966b11806c343000eeeb5d8,2012-11-21 18:36:10.869973
 
1952,3,demo,387,new-group-test-repos1,"",started_following_repo,2012-11-21 21:05:48.945007
 
1953,3,demo,387,new-group-test-repos1,"",user_created_repo,2012-11-21 21:05:48.953815
 
1954,3,demo,388,Logarithmic,"",started_following_repo,2012-11-22 11:30:39.744224
 
1955,3,demo,388,Logarithmic,"",user_created_repo,2012-11-22 11:30:39.761413
 
1956,3,demo,388,Logarithmic,"",push_local:72dd1a9ceecfcf9832e41dd66d355d5c63546b67,2012-11-22 11:35:30.523613
 
1957,3,demo,388,Logarithmic,"",push_local:fdb124c2a063a7ce15a1b3e42cdfa30a5bf19fcb,2012-11-22 11:52:07.237429
 
1958,364,hs_rcdemo,389,hsio_test,"",started_following_repo,2012-11-22 14:32:05.148189
 
1959,364,hs_rcdemo,389,hsio_test,"",user_created_repo,2012-11-22 14:32:05.163464
 
1960,364,hs_rcdemo,389,hsio_test,"",push_local:8777c89c909bfba8eaae07cf596cce85190d7789,2012-11-22 14:33:30.066876
 
1961,364,hs_rcdemo,389,hsio_test,"",user_updated_repo,2012-11-22 14:45:19.518307
 
1962,3,demo,390,ycxs,"",started_following_repo,2012-11-23 08:00:34.880042
 
1963,3,demo,390,ycxs,"",user_created_repo,2012-11-23 08:00:34.889356
 
1964,3,demo,110,django,"",user_commented_revision:129f1ac8484d63c2e61a44fb2a18dd17246c1c4d,2012-11-23 22:54:06.842764
 
1965,3,demo,68,aaa-project,"",user_commented_revision:de5af01cc0f75ab84966b11806c343000eeeb5d8,2012-11-25 18:05:15.626452
 
1966,373,roger,391,roger,"",started_following_repo,2012-11-27 10:19:17.098535
 
1967,373,roger,391,roger,"",user_created_repo,2012-11-27 10:19:17.110165
 
1968,373,roger,391,roger,195.67.17.194,push:3deefa3d90eb91fbfe7c7d97579842d26ffab526,2012-11-27 10:20:14.448706
 
1969,373,roger,394,roger-fork,"",started_following_repo,2012-11-27 10:44:06.565014
 
1970,373,roger,391,roger,"",user_forked_repo:roger-fork,2012-11-27 10:44:06.582941
 
1971,373,roger,394,roger-fork,"",user_created_fork:roger-fork,2012-11-27 10:44:06.591697
 
1972,373,roger,394,roger-fork,195.67.17.194,push:ef5703075e9bd3b498d0398be689c6ecc2aa68f2,2012-11-27 10:46:44.898629
 
1973,373,roger,391,roger,"",user_commented_pull_request:77,2012-11-27 10:49:00.02305
 
1974,373,roger,394,roger-fork,195.67.17.194,push:1f3690bd18da15796e2379ea2f82d510dbbfd634,2012-11-27 10:52:51.819376
 
1975,373,roger,391,roger,"",user_commented_pull_request:78,2012-11-27 10:55:01.836362
 
1976,373,roger,391,roger,"",user_closed_pull_request:78,2012-11-27 10:55:01.843519
 
1977,373,roger,391,roger,"",user_commented_pull_request:77,2012-11-27 10:55:43.206231
 
1978,373,roger,391,roger,"",user_updated_repo,2012-11-27 10:56:53.018675
 
1979,373,roger,391,roger,"",user_updated_repo,2012-11-27 11:02:27.558462
 
1980,373,roger,394,roger-fork,195.67.17.194,push:3a6d267941eeb0a8cd7be18d619d6fe370216f00,2012-11-27 11:04:37.480288
 
1981,374,roger2,391,roger,"",user_commented_pull_request:79,2012-11-27 11:05:56.858694
 
1982,374,roger2,391,roger,"",user_commented_pull_request:79,2012-11-27 11:06:02.182164
 
1983,374,roger2,391,roger,"",user_commented_pull_request:79,2012-11-27 11:06:38.109374
 
1984,374,roger2,391,roger,"",user_commented_pull_request:79,2012-11-27 11:07:34.474704
 
1985,374,roger2,391,roger,"",user_closed_pull_request:79,2012-11-27 11:07:34.485308
 
1986,373,roger,394,roger-fork,195.67.17.194,push:12cd31bebc666a85f8a0f0742093d5cd9ea585c4,2012-11-27 11:09:08.04061
 
1987,373,roger,395,rogerfork2,"",started_following_repo,2012-11-27 11:11:04.332674
 
1988,373,roger,391,roger,"",user_forked_repo:rogerfork2,2012-11-27 11:11:04.348686
 
1989,373,roger,395,rogerfork2,"",user_created_fork:rogerfork2,2012-11-27 11:11:04.359388
 
1990,373,roger,395,rogerfork2,195.67.17.194,"push:ef5703075e9bd3b498d0398be689c6ecc2aa68f2,1f3690bd18da15796e2379ea2f82d510dbbfd634,3a6d267941eeb0a8cd7be18d619d6fe370216f00,12cd31bebc666a85f8a0f0742093d5cd9ea585c4",2012-11-27 11:11:18.920484
 
1991,373,roger,391,roger,"",user_commented_pull_request:80,2012-11-27 11:12:23.228709
 
1992,373,roger,391,roger,"",user_commented_pull_request:80,2012-11-27 11:12:55.017541
 
1993,373,roger,391,roger,"",user_closed_pull_request:80,2012-11-27 11:12:55.027814
 
1994,3,demo,385,aaa-test-repo2-fork,"",push_local:872eeeb3a8a2783129bfd7d988323f5addac7ab1,2012-11-27 11:48:48.630984
 
1995,3,demo,384,aaa-test-repo2,"",user_commented_pull_request:76,2012-11-27 11:50:01.915064
 
1996,3,demo,384,aaa-test-repo2,"",user_commented_pull_request:76,2012-11-27 11:50:12.991796
 
1997,3,demo,384,aaa-test-repo2,"",user_closed_pull_request:76,2012-11-27 11:50:12.99591
 
1998,3,demo,396,тестовый-сервер,"",started_following_repo,2012-11-28 07:53:39.536654
 
1999,3,demo,396,тестовый-сервер,"",user_created_repo,2012-11-28 07:53:39.550591
 
2000,3,demo,397,simple-dev-fork,"",started_following_repo,2012-11-28 09:13:25.051649
 
2001,3,demo,210,simple-dev,"",user_forked_repo:simple-dev-fork,2012-11-28 09:13:25.106104
 
2002,3,demo,397,simple-dev-fork,"",user_created_fork:simple-dev-fork,2012-11-28 09:13:25.114908
 
2003,3,demo,385,aaa-test-repo2-fork,"",user_commented_revision:96abb74e8e96a81a7dc5d472c70158da5318a623,2012-11-28 12:24:53.581825
 
2004,3,demo,385,aaa-test-repo2-fork,"",user_commented_revision:872eeeb3a8a2783129bfd7d988323f5addac7ab1,2012-11-28 12:25:16.961119
 
2005,3,demo,398,aaa-project-fork-fork,"",started_following_repo,2012-11-29 14:08:09.275983
 
2006,3,demo,68,aaa-project,"",user_forked_repo:aaa-project-fork-fork,2012-11-29 14:08:09.413733
 
2007,3,demo,398,aaa-project-fork-fork,"",user_created_fork:aaa-project-fork-fork,2012-11-29 14:08:09.427854
 
2008,3,demo,68,aaa-project,"",user_updated_repo,2012-11-29 14:09:10.934065
 
2009,3,demo,68,aaa-project,"",user_updated_repo,2012-11-29 14:09:24.706033
 
2010,3,demo,399,tra,"",started_following_repo,2012-11-29 14:11:48.839858
 
2011,3,demo,399,tra,"",user_created_repo,2012-11-29 14:11:48.85278
 
2012,3,demo,42,foo,"",user_commented_revision:1b9a14ca778d48ebef5643f7aa2ce142f3a27617,2012-11-29 20:05:08.767523
 
2013,3,demo,42,foo,"",push_local:bb4dab01c0bd4241b903a4dc84a79c70a01b0f6b,2012-11-29 20:06:18.477822
 
2014,1,default,159,group/Test-for-code-review,"",push_local:eaca071ebe45eaf5fc6631b15d7cf079a0d5aaf1,2012-11-29 23:52:50.718898
 
2015,375,paul,400,hophop,"",started_following_repo,2012-11-30 08:50:31.403305
 
2016,375,paul,400,hophop,"",user_created_repo,2012-11-30 08:50:31.416463
 
2017,375,paul,400,hophop,"",push_local:558613aaa69def5e130b8f9583de37f911a80dd8,2012-11-30 08:51:37.956737
 
2018,375,paul,401,flepflep,"",started_following_repo,2012-11-30 08:52:56.146141
 
2019,375,paul,400,hophop,"",user_forked_repo:flepflep,2012-11-30 08:52:56.162784
 
2020,375,paul,401,flepflep,"",user_created_fork:flepflep,2012-11-30 08:52:56.171068
 
2021,375,paul,400,hophop,213.154.235.68,push:0c64f45ec8f43a5267d593a2af65c3b9965c312c,2012-11-30 08:54:23.238053
 
2022,376,mrntest,402,mrntest,"",started_following_repo,2012-11-30 10:10:14.463671
 
2023,376,mrntest,402,mrntest,"",user_created_repo,2012-11-30 10:10:14.475507
 
2024,1,default,159,group/Test-for-code-review,"",push_local:da1270d35961130d6fe12ba4777f412dabb533f7,2012-11-30 18:39:23.68212
 
2025,3,demo,177,blah,"",user_updated_repo,2012-11-30 21:43:04.925873
 
2026,1,default,159,group/Test-for-code-review,"",push_local:3bfcf2015dcc85f3334a4439099b1f4fe2ab87cc,2012-12-01 04:40:25.326381
 
2027,3,demo,385,aaa-test-repo2-fork,"",push_local:8caf16b59f0ac54d002daeaf54208319a055829a,2012-12-01 12:40:27.987379
 
2028,3,demo,385,aaa-test-repo2-fork,"",user_commented_revision:8caf16b59f0ac54d002daeaf54208319a055829a,2012-12-01 12:40:35.315142
 
2029,3,demo,403,aaa-test-repo2-fork1,"",started_following_repo,2012-12-01 12:43:30.698526
 
2030,3,demo,384,aaa-test-repo2,"",user_forked_repo:aaa-test-repo2-fork1,2012-12-01 12:43:30.7817
 
2031,3,demo,403,aaa-test-repo2-fork1,"",user_created_fork:aaa-test-repo2-fork1,2012-12-01 12:43:30.789849
 
2032,3,demo,403,aaa-test-repo2-fork1,"",push_local:7d46cab71f090b82e40f82aa164a237bffae8ca8,2012-12-01 12:43:54.847211
 
2033,3,demo,384,aaa-test-repo2,"",user_commented_pull_request:81,2012-12-01 12:45:15.004235
 
2034,3,demo,384,aaa-test-repo2,"",user_closed_pull_request:81,2012-12-01 12:45:15.01175
 
2035,1,default,159,group/Test-for-code-review,"",push_local:88f2b300127f7249d6b2ac03d4e368cd7a043073,2012-12-02 06:49:39.201427
 
2036,380,han,42,foo,"",user_commented_revision:ca953e8c5c1ada44e9a8f945a0a6999d2f44310d,2012-12-03 05:54:40.845102
 
2037,380,han,42,foo,"",user_commented_revision:ca953e8c5c1ada44e9a8f945a0a6999d2f44310d,2012-12-03 05:54:52.733614
 
2038,380,han,42,foo,"",user_commented_revision:ca953e8c5c1ada44e9a8f945a0a6999d2f44310d,2012-12-03 05:55:06.032348
 
2039,380,han,184,fork-aaa-project,"",user_commented_revision:e3fef0be8dc20eb1fa68fc45292d9d66de1cc67f,2012-12-03 05:55:57.293424
 
2040,380,han,184,fork-aaa-project,"",user_commented_revision:e3fef0be8dc20eb1fa68fc45292d9d66de1cc67f,2012-12-03 05:56:05.503132
 
2041,380,han,184,fork-aaa-project,"",user_commented_revision:e3fef0be8dc20eb1fa68fc45292d9d66de1cc67f,2012-12-03 05:56:11.78452
 
2042,381,tmilos,265,mercurial-trunk,"",user_commented_revision:b3f0f9a39c4e1d0250048cd803ab03542d6f140a,2012-12-03 08:18:24.126434
 
2043,381,tmilos,265,mercurial-trunk,"",user_commented_revision:b3f0f9a39c4e1d0250048cd803ab03542d6f140a,2012-12-03 08:18:53.783535
 
2044,3,demo,68,aaa-project,"",user_commented_revision:0c33fa58efc5a5541d8d3f1a3d3b77367e3d94f5,2012-12-03 13:51:26.584571
 
2045,3,demo,384,aaa-test-repo2,"",user_updated_repo,2012-12-03 13:59:51.134475
 
2046,3,demo,68,aaa-project,"",user_updated_repo,2012-12-03 14:12:42.587904
 
2047,3,demo,404,Test-Repo-5,"",started_following_repo,2012-12-03 19:58:28.17924
 
2048,3,demo,404,Test-Repo-5,"",admin_created_repo,2012-12-03 19:58:28.215537
 
2049,3,demo,382,aaa-repo-fork,"",push_local:d49133c59d2b74bf5754fab639520fe0f15f660b,2012-12-03 23:45:38.954154
 
2050,5,natosha.bard,405,test-largefiles-push,"",started_following_repo,2012-12-04 14:15:02.062567
 
2051,5,natosha.bard,405,test-largefiles-push,"",admin_created_repo,2012-12-04 14:15:02.07345
 
2052,5,natosha.bard,405,test-largefiles-push,62.116.219.97,push:3055a4c8ccb9b695a7973aa25aa118b0dde122e4,2012-12-04 14:15:19.101956
 
2053,5,natosha.bard,405,test-largefiles-push,62.116.219.97,push:88adc5944c74488164ae575511429ed582a72e17,2012-12-04 14:40:10.373812
 
2054,384,test1234,406,test123456,"",started_following_repo,2012-12-04 16:07:07.967514
 
2055,384,test1234,406,test123456,"",admin_created_repo,2012-12-04 16:07:07.987393
 
2058,5,natosha.bard,408,test-repo-natosha,"",started_following_repo,2012-12-04 20:41:39.763055
 
2059,5,natosha.bard,408,test-repo-natosha,"",admin_created_repo,2012-12-04 20:41:39.775062
 
2056,5,natosha.bard,,hg,"",started_following_repo,2012-12-04 20:40:00.327829
 
2057,5,natosha.bard,,hg,"",admin_created_repo,2012-12-04 20:40:00.342796
 
2060,5,natosha.bard,,hg,"",user_deleted_repo,2012-12-04 20:42:03.236535
 
2062,5,natosha.bard,409,test-repo-natosha-fork,"",started_following_repo,2012-12-04 20:43:25.363199
 
2063,5,natosha.bard,408,test-repo-natosha,"",user_forked_repo:test-repo-natosha-fork,2012-12-04 20:43:25.413303
 
2064,5,natosha.bard,409,test-repo-natosha-fork,"",user_created_fork:test-repo-natosha-fork,2012-12-04 20:43:25.421503
 
2065,5,natosha.bard,409,test-repo-natosha-fork,62.116.219.97,"push:132a288f32d5b70a9170e504028c693cfffc5c39,fac6d36d04cb1838cd10bdcecd487567787fb853,e83c482c6c5fd60f14d1a5f5cf9b4f7b2a2eb3cb,ce2c709a8e908747376a3fda6059c1f81de321e7,45bd0cd7ca04f8cda0a61cddded8838dd312675a,35ba170c0f82dba18f0207ef4bd93216e6de8bbf,407209261f6373b4b3f35e343d1498b63263d38e,6f79c32c0bdfb304b984b5e6ba318cc63032cfa4,54cedee86e5126188b0dcfbd7015bcdca7f6c2e2,b0affcb67cba58db03ca3e443105fbaabd1bc88a,4c29668ca316422891e28c55bd794eee52823554,6180dcb29ec531c5d7457005ef142ea304ef49d8,2c63896783e31908f18088a7e9c583de6ec530bf,b3ec0b5fd7771b401392a83f47e0c2360e7f6d90,e689b0d9154605b8b04989c4fdd36e76d6cf26b8,b74361cf7c0ad6930a865e7eada13e2d2d6ed380,f94ead93406764ffd0c3febfc2ea70d36a2a28bb,848345a8d6adaa58704baecbb7567b275df3cc9d,0c10cf8191469e7c3c8844922e17e71a176cb7cb",2012-12-04 20:44:13.658236
 
2066,1,default,159,group/Test-for-code-review,"",push_local:b77f1d54f1d18c22e497f1d9d502e0d540506d21,2012-12-05 00:22:33.617864
 
2067,3,demo,410,aaa-project-fork-fork-fork-fork-fork-blah,"",started_following_repo,2012-12-05 10:07:05.333082
 
2068,3,demo,398,aaa-project-fork-fork,"",user_forked_repo:aaa-project-fork-fork-fork-fork-fork-blah,2012-12-05 10:07:05.47808
 
2069,3,demo,410,aaa-project-fork-fork-fork-fork-fork-blah,"",user_created_fork:aaa-project-fork-fork-fork-fork-fork-blah,2012-12-05 10:07:05.487482
 
2070,387,ssssss,411,sss-test,"",started_following_repo,2012-12-05 13:33:27.008097
 
2071,387,ssssss,411,sss-test,"",admin_created_repo,2012-12-05 13:33:27.018183
 
2072,387,ssssss,411,sss-test,"",user_updated_repo,2012-12-05 13:37:35.771478
 
2073,387,ssssss,411,sss-test,"",user_updated_repo,2012-12-05 13:38:00.979078
 
2074,387,ssssss,411,sss-test,"",user_updated_repo,2012-12-05 13:38:05.497667
 
2075,387,ssssss,411,sss-test,"",user_updated_repo,2012-12-05 13:38:12.513828
 
2076,387,ssssss,173,code-review-dev,"",started_following_repo,2012-12-05 13:46:51.940453
 
2077,387,ssssss,173,code-review-dev,"",stopped_following_repo,2012-12-05 13:46:54.738489
 
2078,387,ssssss,411,sss-test,109.195.177.171,push:7d42587da267871709bc82e462018b8b7d66a4a7,2012-12-05 13:59:09.546916
 
2079,387,ssssss,411,sss-test,109.195.177.171,push:bb869421c7c8f88590536d559cebd3ee5e9c3aa7,2012-12-05 14:00:27.04582
 
2080,387,ssssss,411,sss-test,"",user_updated_repo,2012-12-05 14:03:48.47955
 
2081,389,wwwwww,412,sss-test-fork,"",started_following_repo,2012-12-05 14:05:13.355226
 
2082,389,wwwwww,411,sss-test,"",user_forked_repo:sss-test-fork,2012-12-05 14:05:13.663527
 
2083,389,wwwwww,412,sss-test-fork,"",user_created_fork:sss-test-fork,2012-12-05 14:05:13.678367
 
2084,389,wwwwww,412,sss-test-fork,"",user_updated_repo,2012-12-05 14:05:56.566769
 
2085,389,wwwwww,412,sss-test-fork,109.195.177.171,push:20bd46e65a056aef107cc060d16c97b1ef2cc211,2012-12-05 14:07:21.399133
 
2086,389,wwwwww,412,sss-test-fork,"",user_commented_revision:20bd46e65a056aef107cc060d16c97b1ef2cc211,2012-12-05 14:16:56.716099
 
2087,387,ssssss,411,sss-test,"",user_updated_repo,2012-12-05 14:20:41.385001
 
2088,389,wwwwww,411,sss-test,109.195.177.171,push:20bd46e65a056aef107cc060d16c97b1ef2cc211,2012-12-05 14:20:54.878385
 
2089,387,ssssss,411,sss-test,"",user_updated_repo,2012-12-05 14:21:15.330812
 
2090,389,wwwwww,412,sss-test-fork,109.195.177.171,push:1203172be2e12aa31ec40ba4d07b75a3e17bd63f,2012-12-05 14:23:18.297453
 
2091,389,wwwwww,412,sss-test-fork,"",user_commented_revision:1203172be2e12aa31ec40ba4d07b75a3e17bd63f,2012-12-05 14:23:34.233486
 
2092,5,natosha.bard,413,natosha-repo1,"",started_following_repo,2012-12-05 16:46:55.328513
 
2093,5,natosha.bard,413,natosha-repo1,"",admin_created_repo,2012-12-05 16:46:55.342146
 
2094,5,natosha.bard,413,natosha-repo1,62.116.219.97,"push:6fbe2a2357168359aacbc524f4acd805dff72327,5787c391ba8f9d67b4e96f47d71adab79b693a30",2012-12-05 16:47:09.181828
 
2095,5,natosha.bard,414,natosha-repo1-fork,"",started_following_repo,2012-12-05 16:47:24.080447
 
2096,5,natosha.bard,413,natosha-repo1,"",user_forked_repo:natosha-repo1-fork,2012-12-05 16:47:24.101525
 
2097,5,natosha.bard,414,natosha-repo1-fork,"",user_created_fork:natosha-repo1-fork,2012-12-05 16:47:24.113866
 
2098,5,natosha.bard,414,natosha-repo1-fork,62.116.219.97,"push:a25c825fd81d069596d614efcf92505aed46227a,ac513595518923aca8b39f0a1c33c4c6e0f9d83a,d395e22e8e16373a1fffbe66b322581d69a7db17",2012-12-05 16:47:44.701535
 
2099,2,admin,38,code-review-test,"",user_commented_pull_request:73,2012-12-05 17:23:18.059481
 
2100,390,this-is-it,415,this,"",user_created_repo,2017-01-22 00:00:00.000000
 
2101,390,this-is-it,416,this/is-it,"",user_created_repo,2017-01-22 00:00:01.000000
kallithea/tests/functional/test_admin.py
Show inline comments
 
import os
 
import csv
 
import datetime
 
from kallithea.tests.base import *
 
from kallithea.model.db import UserLog
 
from kallithea.model.meta import Session
 
from kallithea.lib.utils2 import safe_unicode
 
from os.path import dirname
 

	
 
FIXTURES = os.path.join(dirname(dirname(os.path.abspath(__file__))), 'fixtures')
 

	
 

	
 
class TestAdminController(TestController):
 

	
 
    @classmethod
 
    def setup_class(cls):
 
        UserLog.query().delete()
 
        Session().commit()
 

	
 
        def strptime(val):
 
            fmt = '%Y-%m-%d %H:%M:%S'
 
            if '.' not in val:
 
                return datetime.datetime.strptime(val, fmt)
 

	
 
            nofrag, frag = val.split(".")
 
            date = datetime.datetime.strptime(nofrag, fmt)
 

	
 
            frag = frag[:6]  # truncate to microseconds
 
            frag += (6 - len(frag)) * '0'  # add 0s
 
            return date.replace(microsecond=int(frag))
 

	
 
        with open(os.path.join(FIXTURES, 'journal_dump.csv')) as f:
 
            for row in csv.DictReader(f):
 
                ul = UserLog()
 
                for k, v in row.iteritems():
 
                    v = safe_unicode(v)
 
                    if k == 'action_date':
 
                        v = strptime(v)
 
                    if k in ['user_id', 'repository_id']:
 
                        # nullable due to FK problems
 
                        v = None
 
                    setattr(ul, k, v)
 
                Session().add(ul)
 
            Session().commit()
 

	
 
    @classmethod
 
    def teardown_class(cls):
 
        UserLog.query().delete()
 
        Session().commit()
 

	
 
    def test_index(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='admin/admin', action='index'))
 
        response.mustcontain('Admin Journal')
 

	
 
    def test_filter_all_entries(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='admin/admin', action='index',))
 
        response.mustcontain('2034 Entries')
 
        response.mustcontain(' 2036 Entries')
 

	
 
    def test_filter_journal_filter_exact_match_on_repository(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='admin/admin', action='index',
 
                                    filter='repository:xxx'))
 
        response.mustcontain('3 Entries')
 
        response.mustcontain(' 3 Entries')
 

	
 
    def test_filter_journal_filter_exact_match_on_repository_CamelCase(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='admin/admin', action='index',
 
                                    filter='repository:XxX'))
 
        response.mustcontain('3 Entries')
 
        response.mustcontain(' 3 Entries')
 

	
 
    def test_filter_journal_filter_wildcard_on_repository(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='admin/admin', action='index',
 
                                    filter='repository:*test*'))
 
        response.mustcontain('862 Entries')
 
        response.mustcontain(' 862 Entries')
 

	
 
    def test_filter_journal_filter_prefix_on_repository(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='admin/admin', action='index',
 
                                    filter='repository:test*'))
 
        response.mustcontain('257 Entries')
 
        response.mustcontain(' 257 Entries')
 

	
 
    def test_filter_journal_filter_prefix_on_repository_CamelCase(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='admin/admin', action='index',
 
                                    filter='repository:Test*'))
 
        response.mustcontain('257 Entries')
 
        response.mustcontain(' 257 Entries')
 

	
 
    def test_filter_journal_filter_prefix_on_repository_and_user(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='admin/admin', action='index',
 
                                    filter='repository:test* AND username:demo'))
 
        response.mustcontain('130 Entries')
 
        response.mustcontain(' 130 Entries')
 

	
 
    def test_filter_journal_filter_prefix_on_repository_or_other_repo(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='admin/admin', action='index',
 
                                    filter='repository:test* OR repository:xxx'))
 
        response.mustcontain('260 Entries')  # 257 + 3
 
        response.mustcontain(' 260 Entries')  # 257 + 3
 

	
 
    def test_filter_journal_filter_exact_match_on_username(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='admin/admin', action='index',
 
                                    filter='username:demo'))
 
        response.mustcontain('1087 Entries')
 
        response.mustcontain(' 1087 Entries')
 

	
 
    def test_filter_journal_filter_exact_match_on_username_camelCase(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='admin/admin', action='index',
 
                                    filter='username:DemO'))
 
        response.mustcontain('1087 Entries')
 
        response.mustcontain(' 1087 Entries')
 

	
 
    def test_filter_journal_filter_wildcard_on_username(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='admin/admin', action='index',
 
                                    filter='username:*test*'))
 
        response.mustcontain('100 Entries')
 
        response.mustcontain(' 100 Entries')
 

	
 
    def test_filter_journal_filter_prefix_on_username(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='admin/admin', action='index',
 
                                    filter='username:demo*'))
 
        response.mustcontain('1101 Entries')
 
        response.mustcontain(' 1101 Entries')
 

	
 
    def test_filter_journal_filter_prefix_on_user_or_other_user(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='admin/admin', action='index',
 
                                    filter='username:demo OR username:volcan'))
 
        response.mustcontain('1095 Entries')  # 1087 + 8
 
        response.mustcontain(' 1095 Entries')  # 1087 + 8
 

	
 
    def test_filter_journal_filter_wildcard_on_action(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='admin/admin', action='index',
 
                                    filter='action:*pull_request*'))
 
        response.mustcontain('187 Entries')
 
        response.mustcontain(' 187 Entries')
 

	
 
    def test_filter_journal_filter_on_date(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='admin/admin', action='index',
 
                                    filter='date:20121010'))
 
        response.mustcontain('47 Entries')
 
        response.mustcontain(' 47 Entries')
 

	
 
    def test_filter_journal_filter_on_date_2(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='admin/admin', action='index',
 
                                    filter='date:20121020'))
 
        response.mustcontain('17 Entries')
 
        response.mustcontain(' 17 Entries')
 

	
 
    @parametrize('filter,hit', [
 
        #### "repository:" filtering
 
        # "/" is used for grouping
 
        ('repository:group/test', 0),
 
        # "-" is often used for "-fork"
 
        ('repository:fork-test1', 0),
 
        # using "stop words"
 
        ('repository:this', 2036),
 
        ('repository:this/is-it', 2036),
 

	
 
        ## additional tests to quickly find out regression in the future
 
        ## (and check case-insensitive search, too)
 
        # non-ascii character "." and "-"
 
        ('repository:TESTIES1.2.3', 4),
 
        ('repository:test_git_repo', 2),
 
        # combination with wildcard "*"
 
        ('repository:GROUP/*', 182),
 
        ('repository:*/test', 7),
 
        ('repository:fork-*', 273),
 
        ('repository:*-Test1', 5),
 

	
 
        #### "username:" filtering
 
        # "-" is valid character
 
        ('username:peso-xxx', 0),
 
        # using "stop words"
 
        ('username:this-is-it', 2036),
 

	
 
        ## additional tests to quickly find out regression in the future
 
        ## (and check case-insensitive search, too)
 
        # non-ascii character "." and "-"
 
        ('username:ADMIN_xanroot', 6),
 
        ('username:robert.Zaremba', 3),
 
        # combination with wildcard "*"
 
        ('username:THIS-*', 2),
 
        ('username:*-IT', 2),
 
    ])
 
    def test_filter_journal_filter_tokenization(self, filter, hit):
 
        self.log_user()
 

	
 
        response = self.app.get(url(controller='admin/admin', action='index',
 
                                    filter=filter))
 
        if hit != 1:
 
            response.mustcontain(' %s Entries' % hit)
 
        else:
 
            response.mustcontain(' 1 Entry')
kallithea/tests/functional/test_search_indexing.py
Show inline comments
 
new file 100644
 
import mock
 

	
 
from kallithea import CONFIG
 
from kallithea.config.conf import INDEX_FILENAMES
 
from kallithea.model.meta import Session
 
from kallithea.model.repo import RepoModel
 
from kallithea.model.repo_group import RepoGroupModel
 
from kallithea.tests.base import *
 
from kallithea.tests.fixture import create_test_index, Fixture
 

	
 
fixture = Fixture()
 

	
 
def init_indexing_test(repo):
 
    prev = fixture.commit_change(repo.repo_name,
 
                                 filename='this_should_be_unique_filename.txt',
 
                                 content='this_should_be_unique_content\n',
 
                                 message='this_should_be_unique_commit_log',
 
                                 vcs_type='hg',
 
                                 newfile=True)
 

	
 
def init_stopword_test(repo):
 
    prev = fixture.commit_change(repo.repo_name,
 
                                 filename='this/is/it',
 
                                 content='def test\n',
 
                                 message='bother to ask where - in folder',
 
                                 vcs_type='hg',
 
                                 newfile=True)
 
    prev = fixture.commit_change(repo.repo_name,
 
                                 filename='join.us',
 
                                 content='def test\n',
 
                                 message='bother to ask where - top level',
 
                                 author='this is it <this-is-it@foo.bar.com>',
 
                                 vcs_type='hg',
 
                                 parent=prev,
 
                                 newfile=True)
 

	
 
repos = [
 
    # reponame,              init func or fork base, groupname
 
    (u'indexing_test',       init_indexing_test,     None),
 
    (u'indexing_test-fork',  u'indexing_test',       None),
 
    (u'group/indexing_test', u'indexing_test',       u'group'),
 
    (u'this-is-it',          u'indexing_test',       None),
 
    (u'indexing_test-foo',   u'indexing_test',       None),
 
    (u'indexing_test-FOO',   u'indexing_test',       None),
 
    (u'stopword_test',       init_stopword_test,     None),
 
]
 

	
 
# map: name => id
 
repoids = {}
 
groupids = {}
 

	
 
def rebuild_index(full_index):
 
    with mock.patch('kallithea.lib.indexers.daemon.log.debug',
 
                    lambda *args, **kwargs: None):
 
        # The more revisions managed repositories have, the more
 
        # memory capturing "log.debug()" output in "indexers.daemon"
 
        # requires. This may cause unintentional failure of subsequent
 
        # tests, if ENOMEM at forking "git" prevents from rebuilding
 
        # index for search.
 
        # Therefore, "log.debug()" is disabled regardless of logging
 
        # level while rebuilding index.
 
        # (FYI, ENOMEM occurs at forking "git" with python 2.7.3,
 
        # Linux 3.2.78-1 x86_64, 3GB memory, and no ulimit
 
        # configuration for memory)
 
        create_test_index(TESTS_TMP_PATH, CONFIG, full_index=full_index)
 

	
 

	
 
class TestSearchControllerIndexing(TestController):
 
    @classmethod
 
    def setup_class(cls):
 
        for reponame, init_or_fork, groupname in repos:
 
            if groupname and groupname not in groupids:
 
                group = fixture.create_repo_group(groupname)
 
                groupids[groupname] = group.group_id
 
            if callable(init_or_fork):
 
                repo = fixture.create_repo(reponame,
 
                                           repo_group=groupname)
 
                init_or_fork(repo)
 
            else:
 
                repo = fixture.create_fork(init_or_fork, reponame,
 
                                           repo_group=groupname)
 
            repoids[reponame] = repo.repo_id
 

	
 
        # treat "it" as indexable filename
 
        filenames_mock = list(INDEX_FILENAMES)
 
        filenames_mock.append('it')
 
        with mock.patch('kallithea.lib.indexers.daemon.INDEX_FILENAMES',
 
                        filenames_mock):
 
            rebuild_index(full_index=False) # only for newly added repos
 

	
 
    @classmethod
 
    def teardown_class(cls):
 
        # delete in reversed order, to delete fork destination at first
 
        for reponame, init_or_fork, groupname in reversed(repos):
 
            RepoModel().delete(repoids[reponame])
 

	
 
        for reponame, init_or_fork, groupname in reversed(repos):
 
            if groupname in groupids:
 
                RepoGroupModel().delete(groupids.pop(groupname),
 
                                        force_delete=True)
 

	
 
        Session().commit()
 
        Session.remove()
 

	
 
        rebuild_index(full_index=True) # rebuild fully for subsequent tests
 

	
 
    @parametrize('reponame', [
 
        (u'indexing_test'),
 
        (u'indexing_test-fork'),
 
        (u'group/indexing_test'),
 
        (u'this-is-it'),
 
        (u'*-fork'),
 
        (u'group/*'),
 
    ])
 
    @parametrize('searchtype,query,hit', [
 
        #('content', 'this_should_be_unique_content', 1),
 
        ('commit', 'this_should_be_unique_commit_log', 1),
 
        #('path', 'this_should_be_unique_filename.txt', 1),
 
    ])
 
    def test_repository_tokenization(self, reponame, searchtype, query, hit):
 
        self.log_user()
 

	
 
        q = 'repository:%s %s' % (reponame, query)
 
        response = self.app.get(url(controller='search', action='index'),
 
                                {'q': q, 'type': searchtype})
 
        response.mustcontain('>%d results' % hit)
 

	
 
    @parametrize('searchtype,query,hit', [
 
        ('content', 'this_should_be_unique_content', 2),
 
        ('commit', 'this_should_be_unique_commit_log', 1),
 
        ('path', 'this_should_be_unique_filename.txt', 2),
 
    ])
 
    def test_repository_case_sensitivity(self, searchtype, query, hit):
 
        self.log_user()
 

	
 
        lname = u'indexing_test-foo'
 
        uname = u'indexing_test-FOO'
 

	
 
        # (1) "repository:REPONAME" condition should match against
 
        # repositories case-insensitively
 
        q = 'repository:%s %s' % (lname, query)
 
        response = self.app.get(url(controller='search', action='index'),
 
                                {'q': q, 'type': searchtype})
 

	
 
        response.mustcontain('>%d results' % hit)
 

	
 
        # (2) on the other hand, searching under the specific
 
        # repository should return results only for that repository,
 
        # even if specified name matches against another repository
 
        # case-insensitively.
 
        response = self.app.get(url(controller='search', action='index',
 
                                    repo_name=uname),
 
                                {'q': query, 'type': searchtype})
 

	
 
        response.mustcontain('>%d results' % hit)
 

	
 
        # confirm that there is no matching against lower name repository
 
        assert uname in response
 
        #assert lname not in response
 

	
 
    @parametrize('searchtype,query,hit', [
 
        ('content', 'path:this/is/it def test', 37),
 
        ('commit', 'added:this/is/it bother to ask where', 4),
 
        # this condition matches against files below, because
 
        # "path:" condition is also applied on "repository path".
 
        # - "this/is/it" in "stopword_test" repo
 
        # - "this_should_be_unique_filename.txt" in "this-is-it" repo
 
        ('path', 'this/is/it', 0),
 

	
 
        ('content', 'extension:us', 0),
 
        ('path', 'extension:us', 0),
 
    ])
 
    def test_filename_stopword(self, searchtype, query, hit):
 
        response = self.app.get(url(controller='search', action='index'),
 
                                {'q': query, 'type': searchtype})
 

	
 
        response.mustcontain('>%d results' % hit)
 

	
 
    @parametrize('searchtype,query,hit', [
 
        # matching against both 2 files
 
        ('content', 'owner:"this is it"', 0),
 
        ('content', 'owner:this-is-it', 0),
 
        ('path', 'owner:"this is it"', 0),
 
        ('path', 'owner:this-is-it', 0),
 

	
 
        # matching against both 2 revisions
 
        ('commit', 'owner:"this is it"', 0),
 
        ('commit', 'owner:"this-is-it"', 0),
 

	
 
        # matching against only 1 revision
 
        ('commit', 'author:"this is it"', 0),
 
        ('commit', 'author:"this-is-it"', 0),
 
    ])
 
    def test_mailaddr_stopword(self, searchtype, query, hit):
 
        response = self.app.get(url(controller='search', action='index'),
 
                                {'q': query, 'type': searchtype})
 

	
 
        response.mustcontain('>%d results' % hit)
0 comments (0 inline, 0 general)