Wiki2Go 1.17.5 → 1.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. data/bin/Wiki2Go_firewall_blacklist.rb +8 -0
  2. data/bin/Wiki2Go_make_cvs_repository.rb +1 -0
  3. data/bin/Wiki2Go_make_site.rb +1 -2
  4. data/bin/Wiki2Go_update_site.rb +1 -2
  5. data/lib/Web2Go/CGIRequest.rb +8 -2
  6. data/lib/Web2Go/CGIResponse.rb +17 -14
  7. data/lib/Web2Go/MockRequest.rb +12 -2
  8. data/lib/Web2Go/MockResponse.rb +10 -7
  9. data/lib/Web2Go/WebrickRequest.rb +106 -101
  10. data/lib/Web2Go/WebrickResponse.rb +4 -8
  11. data/lib/Wiki2Go/BlackList.rb +48 -25
  12. data/lib/Wiki2Go/DotGraphics.rb +1 -1
  13. data/lib/Wiki2Go/FileStorage.rb +266 -266
  14. data/lib/Wiki2Go/HTMLFormatter.rb +28 -0
  15. data/lib/Wiki2Go/Install/config/chonqed_blacklist.txt +418 -0
  16. data/lib/Wiki2Go/Install/config/passwords +1 -1
  17. data/lib/Wiki2Go/Install/config/url_blacklist.txt +3855 -0
  18. data/lib/Wiki2Go/Install/make_repository.rb +32 -26
  19. data/lib/Wiki2Go/Install/make_site.rb +197 -111
  20. data/lib/Wiki2Go/Install/site/error.html +1 -1
  21. data/lib/Wiki2Go/Install/site/robots.txt +10 -1
  22. data/lib/Wiki2Go/Install/site/style.css +129 -64
  23. data/lib/Wiki2Go/Install/templates/admin.htm +1 -1
  24. data/lib/Wiki2Go/Install/templates/admin_pages/edit.txt +2 -1
  25. data/lib/Wiki2Go/Install/templates/admin_pages/format_for_fck.txt +31 -0
  26. data/lib/Wiki2Go/Install/templates/admin_pages/passwords.txt +1 -1
  27. data/lib/Wiki2Go/Install/templates/edit.htm +62 -46
  28. data/lib/Wiki2Go/Install/templates/full_footer.htm +31 -33
  29. data/lib/Wiki2Go/Install/templates/header.htm +0 -1
  30. data/lib/Wiki2Go/Install/templates/menu.htm +29 -0
  31. data/lib/Wiki2Go/Install/templates/pagelist.htm +46 -43
  32. data/lib/Wiki2Go/Install/templates/simple_footer.htm +20 -16
  33. data/lib/Wiki2Go/Install/templates/versionlist.htm +52 -40
  34. data/lib/Wiki2Go/Install/templates/view.htm +46 -29
  35. data/lib/Wiki2Go/Install/templates/wikiedit.htm +63 -0
  36. data/lib/Wiki2Go/Install/wiki/delete.png +0 -0
  37. data/lib/Wiki2Go/Install/wiki/style.css +133 -63
  38. data/lib/Wiki2Go/LineFormatter.rb +345 -197
  39. data/lib/Wiki2Go/Page.rb +16 -3
  40. data/lib/Wiki2Go/PrivateWikiConfig.rb +5 -5
  41. data/lib/Wiki2Go/PublicWikiConfig.rb +83 -37
  42. data/lib/Wiki2Go/ReadWriteWikiConfig.rb +8 -8
  43. data/lib/Wiki2Go/Server.rb +6 -1
  44. data/lib/Wiki2Go/SpamFilter.rb +32 -41
  45. data/lib/Wiki2Go/Web.rb +10 -3
  46. data/lib/Wiki2Go/Wiki2Go.rb +301 -94
  47. data/lib/Wiki2Go/Wiki2GoConfig.rb +87 -6
  48. data/lib/Wiki2Go/Wiki2GoServlet.rb +66 -12
  49. data/lib/Wiki2Go/WikiFormatter.rb +60 -30
  50. data/lib/Wiki2Go/cgi/diff.rb +20 -0
  51. data/lib/Wiki2Go/cgi/secure/log_rss.rb +21 -0
  52. data/lib/Wiki2Go/cgi/sidebyside.rb +20 -0
  53. data/lib/Wiki2Go/cgi/wikiedit.rb +20 -0
  54. data/lib/Wiki2Go/firewall_blacklist.rb +88 -0
  55. data/test/All.rb +5 -2
  56. data/test/TestBlackList.rb +70 -14
  57. data/test/TestConfig.rb +5 -5
  58. data/test/TestDiff.rb +95 -0
  59. data/test/TestFormatter.rb +14 -16
  60. data/test/TestHTMLFormatter.rb +37 -0
  61. data/test/TestInstall.rb +70 -27
  62. data/test/TestLineFormatter.rb +71 -15
  63. data/test/TestRSS.rb +8 -7
  64. data/test/TestRepository.rb +50 -0
  65. data/test/TestServer.rb +3 -8
  66. data/test/TestSpamFilter.rb +33 -1
  67. data/test/TestStorage.rb +11 -0
  68. data/test/TestWeb.rb +2 -2
  69. data/test/TestWiki2Go.rb +766 -166
  70. data/test/TestWiki2GoServlet.rb +1122 -524
  71. data/test/UnitTestFiles.rb +7 -3
  72. data/test/Wiki2GoConfigForTest.rb +40 -6
  73. data/test/checksite.rb +17 -50
  74. data/test/test_firewall_blacklist.rb +131 -0
  75. data/test/test_page.rb +45 -0
  76. data/test/testdata/Registration.rbl.txt +7 -0
  77. data/test/testdata/config/url_blacklist.txt +38822 -0
  78. data/test/testdata/expected_changes.html +1 -2
  79. data/test/testdata/expected_edit.html +108 -59
  80. data/test/testdata/expected_full_rss.xml +2 -2
  81. data/test/testdata/expected_out.html +97 -61
  82. data/test/testdata/expected_put.html +88 -53
  83. data/test/testdata/expected_save.html +88 -52
  84. data/test/testdata/expected_savehtml.html +88 -52
  85. data/test/testdata/expected_search.html +68 -53
  86. data/test/testdata/expected_upload.html +88 -53
  87. data/test/testdata/expected_versions.html +97 -82
  88. data/test/testdata/expected_view.html +97 -61
  89. data/test/testdata/firewall/iptables.config +37 -0
  90. data/test/testdata/firewall/user_blacklist.txt +162 -0
  91. data/test/testdata/logs/wiki.log +652 -0
  92. data/test/testdata/logs/wiki.log.0 +113 -0
  93. data/test/testdata/logs/wiki.log.1 +113 -0
  94. data/test/testdata/logs/wiki.log.2 +113 -0
  95. data/test/testdata/logs/wiki.log.3 +115 -0
  96. data/test/testdata/logs/wiki.log.4 +5 -0
  97. data/test/testdata/logs/wiki.log.5 +7 -0
  98. data/test/testdata/logs/wiki.log.6 +5 -0
  99. data/test/testdata/logs/wiki.log.7 +118 -0
  100. data/test/testdata/logs/wiki.log.8 +12 -0
  101. data/test/testdata/site/html/Xpday/rss.xml +53 -103
  102. data/test/testdata/texts/Bugs/FrontPage.txt +6 -0
  103. data/test/testdata/texts/Bugs/NoHidden.spam +17850 -0
  104. data/test/testdata/texts/Bugs/PairProgrammingParties.spam +102 -0
  105. data/test/testdata/texts/Bugs/PairProgrammingParties.txt +99 -0
  106. metadata +53 -7
  107. data/test/TestMail.rb +0 -29
  108. data/test/gc.log +0 -2
@@ -0,0 +1,50 @@
1
+
2
+ #!/usr/bin/ruby
3
+ $:.unshift File.expand_path(File.join(File.dirname(__FILE__),'..','lib'))
4
+
5
+
6
+ require 'test/unit'
7
+
8
+ require "Wiki2Go/Install/make_site"
9
+ require "Wiki2Go/Install/make_repository"
10
+ require 'fileutils'
11
+ require 'UnitTestFiles'
12
+
13
+ include FileUtils
14
+
15
+ class TestRepository < Test::Unit::TestCase
16
+
17
+ def test_make_repository
18
+ scratch = scratch_dir('testcvs')
19
+ repository_dir = File.join(scratch,'repository')
20
+ wiki_dir = File.join(scratch,'readwrite')
21
+ user = ENV['USER'] || ENV['USERNAME']
22
+ args = ['-d', repository_dir , '-u' ,user, '-g' , user, '-m' , 'readwrite']
23
+ Wiki2Go::RepositoryMaker.create(args)
24
+ assert File.exists?(repository_dir)
25
+
26
+ args = ['-s', 'http://wiki2go.nayima.be/blog' , '-w' , 'Wiki2Go' , '-t' , 'readwrite', '-d' , wiki_dir]
27
+ Wiki2Go::Install.make_site(args)
28
+
29
+ args = ['-d', repository_dir , '-w' ,wiki_dir, '-m' , 'readwrite']
30
+ added = Wiki2Go::RepositoryMaker.addwiki(args)
31
+ added = Wiki2Go::RepositoryMaker.addwiki(args)
32
+ assert_equal 0,added.length
33
+ args = ['-d', repository_dir , '-w' ,wiki_dir]
34
+ Wiki2Go::RepositoryMaker.updatewiki(args)
35
+ end
36
+
37
+
38
+ private
39
+
40
+ def scratch_dir(type)
41
+ dest = UnitTestFiles.scratchdata('wiki',type)
42
+ if File.exists?(dest) then
43
+ rm_rf(dest)
44
+ end
45
+ mkdir_p dest
46
+ dest
47
+ end
48
+
49
+ end
50
+
data/test/TestServer.rb CHANGED
@@ -20,7 +20,7 @@ class TestServer < Test::Unit::TestCase
20
20
  assert(!server.nil?)
21
21
  thread = server.start { |config|
22
22
  assert_equal('81',config.port)
23
- assert_equal('.',config.root_directory)
23
+ assert_equal(Dir.getwd,config.root_directory)
24
24
  assert_equal(true,config.multi_wiki)
25
25
  }
26
26
  sleep(5) # Let the webserver start
@@ -41,10 +41,10 @@ class TestServer < Test::Unit::TestCase
41
41
  assert(!server.nil?)
42
42
  thread = server.start { |config|
43
43
  assert_equal('81',config.port)
44
- assert_equal('.',config.root_directory)
44
+ assert_equal(Dir.getwd,config.root_directory)
45
45
  assert_equal(false,config.multi_wiki)
46
46
  }
47
- sleep(5) # Let the webserver start
47
+ sleep(15) # Let the webserver start
48
48
 
49
49
  Net::HTTP.start('localhost', 81) { |http|
50
50
  response = http.get('/view/FrontPage')
@@ -58,8 +58,3 @@ class TestServer < Test::Unit::TestCase
58
58
 
59
59
  end
60
60
 
61
-
62
- if $0 == __FILE__
63
- RUNIT::CUI::TestRunner.run(TestServer.suite)
64
- end
65
-
@@ -24,7 +24,7 @@ class SpamMockStorage
24
24
  end
25
25
  end
26
26
 
27
- def load_blacklist(type)
27
+ def load_blacklist(type,normalize_urls=false)
28
28
  @blacklists[type] = Wiki2Go::BlackList.new(type,[]) if !@blacklists.has_key?(type)
29
29
  @blacklists[type]
30
30
  end
@@ -125,6 +125,38 @@ class TestSpamFilter < Test::Unit::TestCase
125
125
 
126
126
  end
127
127
 
128
+ def test_spamfilter_recognizes_attempts_to_hide_stuff
129
+ content = <<HIDDEN_SPAM
130
+ [BernardVanderBeken] NakedObjects ( http://www.nakedobjects.org ) are an interesting way of implementing a system. A pair could explore this Java/.NET framework in order to learn about the benefits.
131
+ 336275370206207295404361
132
+ <u style="display:none;"> Beneficiaries the on tri-pak
133
+ zithromax copy [ ] patients. National hct
134
+ loprox
135
+ lorabid
136
+ lorazepam
137
+ lorazepam [ ] considers united within good generic are xr
138
+ ciprodex
139
+ ciprofloxacin program's the.</u>
140
+ HIDDEN_SPAM
141
+
142
+ assert @spam_filter.hidden_text_in(content)
143
+ assert @spam_filter.hidden_text_in('<u style = "color:white; display:none;"> Beneficiaries the on tri-pak')
144
+ assert !@spam_filter.hidden_text_in("style = \"display:none\"")
145
+ end
128
146
 
147
+ def test_spamfilter_recognizes_empty_urls
148
+ content = <<EMPTY_URLS
149
+ <a href=" "> </a>
150
+ EMPTY_URLS
151
+
152
+ assert @spam_filter.empty_urls_in(content)
153
+ end
154
+
155
+ def test_spamfilter_detects_clearing_a_page
156
+ assert @spam_filter.cleared_page?('')
157
+ assert @spam_filter.cleared_page?(" \r\n \t \r \n")
158
+
159
+ assert !@spam_filter.cleared_page?(" \r\n a word \t \r \n")
160
+ end
129
161
 
130
162
  end
data/test/TestStorage.rb CHANGED
@@ -130,6 +130,17 @@ class TestStorage < Test::Unit::TestCase
130
130
  assert_equal(page1.name,matches[0].name)
131
131
  end
132
132
 
133
+
134
+ def test_search_accepts_all_input
135
+ page1 = Wiki2Go::Page.new("FrontPage",[ "The Wiki2Go homepage", 'by the Wiki2Go team'], "pvc",Time.now,"FrontPage")
136
+ @storage.save_page("Wiki2Go",page1)
137
+ page2 = Wiki2Go::Page.new("OtherPage",[ 'Some other stuff', 'about Wiki2Go'], "pvc",Time.now,"OtherPage")
138
+ @storage.save_page("Wiki2Go",page1)
139
+
140
+ matches = @storage.search("Wiki2Go",'/Hi[url=http:\/\/uk.geocities.com\/autorentalcar\/car-rental-companies.html]car rental companies[\/url]')
141
+ assert_equal(0,matches.length)
142
+ end
143
+
133
144
  def test_save_spam
134
145
  content = ['line1', 'Line with spam']
135
146
  @storage.save_spam('Xpday','SpamPage',content,'Me')
data/test/TestWeb.rb CHANGED
@@ -132,11 +132,11 @@ class TestWeb < Test::Unit::TestCase
132
132
  def test_login
133
133
  env = {"HTTP_HOST"=>"wiki.xp.be", "HTTP_REFERER"=>"http://wiki.xp.be/scripts/view/Xpbe/PairProgrammingParty2004September14", "HTTP_USER_AGENT"=>"Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0", "PATH"=>"/sbin:/bin:/usr/sbin:/usr/bin:/usr/bin/X11:/usr/local/sbin:/usr/local/bin", "REMOTE_ADDR"=>"80.200.195.232", "REMOTE_PORT"=>"62539", "SCRIPT_FILENAME"=>"/home/pvc/sites/xpbe/wiki2/site//view", "SERVER_ADDR"=>"212.13.211.135", "SERVER_ADMIN"=>"webmaster@nayima.vm.bytemark.co.uk", "SERVER_NAME"=>"wiki.xp.be", "SERVER_PORT"=>"80", "SERVER_SIGNATURE"=>"<ADDRESS>Apache/1.3.26 Server at wiki.xp.be Port 80</ADDRESS>\n", "SERVER_SOFTWARE"=>"Apache/1.3.26 (Unix) Debian GNU/Linux PHP/4.1.2", "GATEWAY_INTERFACE"=>"CGI/1.1", "SERVER_PROTOCOL"=>"HTTP/1.1", "REQUEST_METHOD"=>"GET", "QUERY_STRING"=>"", "REQUEST_URI"=>"/scripts/view/Xpbe/PairProgrammingParties", "SCRIPT_NAME"=>"/scripts/view", "PATH_INFO"=>"/Xpbe/PairProgrammingParties"}
134
134
  web = Wiki2Go::Web.from_request(Web2Go::MockRequest.new('http://wiki.xp.be/scripts/view/Xpbe/PairProgrammingParties',env),@config)
135
- assert(!web.secure)
135
+ assert(!web.secure?)
136
136
  env["AUTH_TYPE"] = "Basic"
137
137
  env["REMOTE_USER"] = "Pascal"
138
138
  web = Wiki2Go::Web.from_request(Web2Go::MockRequest.new('http://wiki.xp.be/scripts/view/Xpbe/PairProgrammingParties',env),@config)
139
- assert(web.secure)
139
+ assert(web.secure?)
140
140
  assert_equal("Pascal",web.user)
141
141
  end
142
142
 
data/test/TestWiki2Go.rb CHANGED
@@ -4,8 +4,9 @@ $:.unshift File.expand_path(File.join(File.dirname(__FILE__),'..','lib'))
4
4
 
5
5
  require 'test/unit'
6
6
 
7
- require "Wiki2Go/WikiFormatter"
8
7
  require "Wiki2Go/Wiki2Go"
8
+
9
+ require "Wiki2Go/WikiFormatter"
9
10
  require "Wiki2Go/Web"
10
11
  require "Wiki2Go/FileStorage"
11
12
  require "Wiki2GoConfigForTest"
@@ -16,169 +17,768 @@ require "UnitTestFiles"
16
17
 
17
18
  class TestWiki2Go < Test::Unit::TestCase
18
19
 
19
- include UnitTestFiles
20
-
21
- def setup
22
- UnitTestFiles.clean
23
- FileUtils.mkdir_p UnitTestFiles.scratchdata
24
- @config = TestDataWiki2GoConfig.new
25
- end
26
-
27
- def teardown
28
- @config.close unless @config.nil?
29
- end
30
-
31
- def test_view
32
- wiki = Wiki2Go::Wiki.new(@config)
33
-
34
- wikiweb = Wiki2Go::Web.from_page_url("http://localhost/view/Xpday/FrontPage","view",@config)
35
-
36
- html = wiki.view(wikiweb)
37
-
38
- assert_same_file_string(testdata('expected_view.html'),scratchdata('generated_view.html'),html)
39
-
40
- end
41
-
42
- def test_versions
43
- wiki = Wiki2Go::Wiki.new(@config)
44
-
45
- wikiweb = Wiki2Go::Web.from_page_url("http://localhost/versions/Xpday/FrontPage","versions",@config)
46
-
47
- html = wiki.versions(wikiweb)
48
-
49
- # assert_same_file_string(testdata('expected_versions.html'),scratchdata('generated_versions.html'),html)
50
-
51
- end
52
-
53
- def test_edit
54
- wiki = Wiki2Go::Wiki.new(@config)
55
-
56
- wikiweb = Wiki2Go::Web.from_page_url("http://localhost/view/Xpday/FrontPage","view",@config)
57
-
58
- html = wiki.edit(wikiweb)
59
-
60
- assert_same_file_string(testdata('expected_edit.html'),scratchdata('generated_edit.html'),html)
61
-
62
- end
63
-
64
- def test_save
65
- @config.close
66
- @config = TestWiki2GoConfig.new
67
- assert(!@config.generate_html)
68
- wiki = Wiki2Go::Wiki.new(@config)
69
-
70
- wikiweb = Wiki2Go::Web.from_page_url("http://localhost/view/Xpday/FrontPage","view",@config)
71
- wiki.save(wikiweb,"FrontPage")
72
-
73
- wikiweb = Wiki2Go::Web.from_page_url("http://localhost/view/Xpday/test","view",@config)
74
- wikiweb.title = "FrontPagename"
75
- redirect_url = wiki.save(wikiweb,"FrontPage")
76
- assert_equal("http://localhost/view/Xpday/test",redirect_url)
77
-
78
- html = wiki.view(wikiweb)
79
-
80
- assert_same_file_string(testdata('expected_save.html'),scratchdata('generated_save.html'),html, { "DATE" => Time.new.strftime("%d/%m/%Y") } )
81
-
82
- end
83
-
84
-
85
-
86
- def test_save_with_html
87
- @config.close
88
- @config = TestWiki2GoConfig.new
89
- @config.generate_html = true
90
-
91
- wiki = Wiki2Go::Wiki.new(@config)
92
-
93
- wikiweb = Wiki2Go::Web.from_page_url("http://localhost/view/Xpday/FrontPage","view",@config)
94
- wiki.save(wikiweb,"FrontPage")
95
-
96
- wikiweb = Wiki2Go::Web.from_page_url("http://localhost/view/Xpday/test","view",@config)
97
-
98
- root = @config.site_directory
99
- path = File.join(root,wikiweb.name, wikiweb.current_page + ".html")
100
- File.delete(path) if File.exists?(path)
101
-
102
- wikiweb.title = "Frontpagename"
103
- redirect_url = wiki.save(wikiweb,"FrontPage")
104
- assert_equal("http://localhost/Xpday/test.html",redirect_url)
105
-
106
- assert(File.exists?(path))
107
- assert_same_file(testdata('expected_savehtml.html'),path, { "DATE" => Time.new.strftime("%d/%m/%Y") } )
108
-
109
- end
110
-
111
- def test_generate_static
112
- @config.close
113
- @config = PrivateTestWiki2GoConfig.new
114
-
115
- wiki = Wiki2Go::Wiki.new(@config)
116
-
117
- request = Web2Go::MockRequest.new('http://localhost:8088/generate_static/NonExistingWeb/FrontPage')
118
- request.authenticated = true
119
- request.user = 'admin'
120
- wikiweb = Wiki2Go::Web.from_request(request,@config)
121
- wiki.save(wikiweb,"FrontPage")
122
- # puts wiki.generate_html(wikiweb)
123
- end
124
-
125
-
126
-
127
- def test_changes
128
- wiki = Wiki2Go::Wiki.new(@config)
129
-
130
- wikiweb = Wiki2Go::Web.page_url("localhost","80","/upload/Xpday","changes",@config)
131
-
132
- html = wiki.changes(wikiweb)
133
-
134
- # assert_same_file_string(testdata('expected_changes.html'),scratchdata('generated_changes.html'),html, { "DATE" => Time.new.strftime("%d/%m/%Y") })
135
-
136
- end
137
-
138
- def test_search
139
- wiki = Wiki2Go::Wiki.new(@config)
140
-
141
- wikiweb = Wiki2Go::Web.page_url("localhost","80","/search/Xpday","search",@config)
142
-
143
- html = wiki.search(wikiweb,"Benelux")
144
-
145
- assert_same_file_string(testdata('expected_search.html'),scratchdata('generated_search.html'),html, { "DATE" => Time.new.strftime("%d/%m/%Y") })
146
-
147
- end
148
-
149
- def test_upload_files
150
- @config.close
151
- @config = TestWiki2GoConfig.new
152
- wiki = Wiki2Go::Wiki.new(@config)
153
-
154
- wikiweb = Wiki2Go::Web.page_url("localhost","80","/upload/Xpday/UploadPage","upload",@config)
155
- wikiweb.title = 'simple'
156
- wiki.save(wikiweb,'A simple page\n')
157
-
158
- redirect = wiki.upload(wikiweb,"brol.txt","hello peops")
159
- assert_equal 'http://localhost/view/Xpday/UploadPage',redirect
160
-
161
- html = wiki.view(wikiweb)
162
- assert_same_file_string(testdata('expected_upload.html'),scratchdata('generated_upload.html'),html, { "DATE" => Time.new.strftime("%d/%m/%Y") })
163
-
164
- redirect = wiki.upload(wikiweb,'',nil)
165
- assert_equal 'http://localhost/view/Xpday/UploadPage',redirect
166
-
167
- html = wiki.view(wikiweb)
168
- assert_same_file_string(testdata('expected_upload.html'),scratchdata('generated_upload.html'),html, { "DATE" => Time.new.strftime("%d/%m/%Y") })
169
-
170
- end
171
-
172
- def test_default_admin_page
173
- wiki = Wiki2Go::Wiki.new(TestWiki2GoConfig.new)
174
- request = Web2Go::MockRequest.new('http://localhost/admin')
175
-
176
- result = wiki.admin(request)
177
-
178
- request = Web2Go::MockRequest.new('http://localhost/admin/regenerate')
179
-
180
- result = wiki.admin(request)
181
-
182
- end
183
-
20
+ include UnitTestFiles
21
+
22
+ def setup
23
+ UnitTestFiles.clean
24
+ FileUtils.mkdir_p UnitTestFiles.scratchdata
25
+ @config = TestDataWiki2GoConfig.new
26
+ end
27
+
28
+ def teardown
29
+ @config.close unless @config.nil?
30
+ end
31
+
32
+ def test_view
33
+ wiki = Wiki2Go::Wiki.new(@config)
34
+
35
+ wikiweb = Wiki2Go::Web.from_page_url("http://localhost/view/Xpday/FrontPage","view",@config)
36
+
37
+ html = wiki.view(wikiweb,-1)
38
+
39
+ assert_same_file_string(testdata('expected_view.html'),scratchdata('generated_view.html'),html)
40
+
41
+ end
42
+
43
+ def test_versions
44
+ @config.close
45
+ @config = ScratchWikiConfig.new
46
+ wiki = Wiki2Go::Wiki.new(@config)
47
+
48
+ wikiweb = Wiki2Go::Web.from_request(Web2Go::MockRequest.new('http://localhost/view/Xpday/FrontPage',{ 'REMOTE_USER' => 'goodgirl'} ),@config)
49
+ wiki.save(wikiweb,"edited by good girl")
50
+
51
+ wikiweb = Wiki2Go::Web.from_request(Web2Go::MockRequest.new('http://localhost/view/Xpday/FrontPage',{ 'REMOTE_USER' => 'evilguy'} ),@config)
52
+ wiki.save(wikiweb,"edited by nasty man who spams")
53
+
54
+ wikiweb = Wiki2Go::Web.from_request(Web2Go::MockRequest.new('http://localhost/view/Xpday/FrontPage',{ 'REMOTE_USER' => 'goodguy'} ),@config)
55
+ wiki.save(wikiweb,"edited by good boy")
56
+
57
+ wikiweb = Wiki2Go::Web.from_page_url("http://localhost/versions/Xpday/FrontPage","versions",@config)
58
+
59
+ blacklist = @config.banned_users
60
+ blacklist.add('evilguy')
61
+
62
+ html = wiki.versions(wikiweb)
63
+ # puts html
64
+
65
+ assert_same_file_string(testdata('expected_versions.html'),scratchdata('generated_versions.html'),html, { "DATE" => Time.new.strftime("%d/%m/%Y") })
66
+
67
+ wikiweb = Wiki2Go::Web.from_request(Web2Go::MockRequest.new('http://localhost/view/Xpday/FrontPage?version=0' ),@config)
68
+
69
+ html = wiki.view(wikiweb,0)
70
+
71
+ assert_match(/edited by good girl/,html,'version 0 should be the first edit')
72
+
73
+ # puts html
74
+
75
+ wikiweb = Wiki2Go::Web.from_request(Web2Go::MockRequest.new('http://localhost/view/Xpday/FrontPage?version=1' ),@config)
76
+
77
+ html = wiki.view(wikiweb,1)
78
+ assert_match(/edited by good boy/,html,'version 1 should be the edit after the spammer')
79
+
80
+ # puts html
81
+
82
+ wikiweb = Wiki2Go::Web.from_request(Web2Go::MockRequest.new('http://localhost/view/Xpday/FrontPage?version=2' ),@config)
83
+
84
+ html = wiki.view(wikiweb,2)
85
+ assert_match(/edited by good boy/,html,'version 1 should be the edit after the spammer')
86
+
87
+ # puts html
88
+ end
89
+
90
+ def test_diff
91
+ @config.close
92
+ @config = ScratchWikiConfig.new
93
+ wiki = Wiki2Go::Wiki.new(@config)
94
+
95
+ wikiweb = Wiki2Go::Web.from_request(Web2Go::MockRequest.new('http://localhost/view/Xpday/FrontPage',{ 'REMOTE_USER' => 'goodgirl'} ),@config)
96
+ wiki.save(wikiweb,"start<br>edited by *good girl & boy*\nI want a pony!")
97
+
98
+ wikiweb = Wiki2Go::Web.from_request(Web2Go::MockRequest.new('http://localhost/view/Xpday/FrontPage',{ 'REMOTE_USER' => 'goodboy'} ),@config)
99
+ wiki.save(wikiweb,"start<br />edited by *good girl & boy*\nI hate ponies!")
100
+
101
+ html = wiki.diff(wikiweb,0,1)
102
+ # puts html
103
+ assert_same_markup_strings(expected_diff,html, { "DATE" => Time.new.strftime("%d/%m/%Y") })
104
+
105
+ end
106
+
107
+ def test_diff_with_multiple_versions
108
+ @config.close
109
+ @config = ScratchWikiConfig.new
110
+ wiki = Wiki2Go::Wiki.new(@config)
111
+
112
+ wikiweb = Wiki2Go::Web.from_request(Web2Go::MockRequest.new('http://localhost/view/Xpday/FrontPage',{ 'REMOTE_USER' => 'goodgirl'} ),@config)
113
+ wiki.save(wikiweb,"Edited by good girl\nVersion 0")
114
+
115
+ wikiweb = Wiki2Go::Web.from_request(Web2Go::MockRequest.new('http://localhost/view/Xpday/FrontPage',{ 'REMOTE_USER' => 'goodboy'} ),@config)
116
+ wikiweb.title = "Front Page"
117
+ wiki.save(wikiweb,"Edited by good boy\nVersion 1")
118
+
119
+ wikiweb = Wiki2Go::Web.from_request(Web2Go::MockRequest.new('http://localhost/view/Xpday/FrontPage',{ 'REMOTE_USER' => 'goodgirl'} ),@config)
120
+ wiki.save(wikiweb,"Edited by good girl\nVersion 2")
121
+
122
+ wikiweb = Wiki2Go::Web.from_request(Web2Go::MockRequest.new('http://localhost/view/Xpday/FrontPage',{ 'REMOTE_USER' => 'goodboy'} ),@config)
123
+ wiki.save(wikiweb,"Edited by good boy\nVersion 3")
124
+
125
+ wikiweb = Wiki2Go::Web.from_request(Web2Go::MockRequest.new('http://localhost/view/Xpday/FrontPage',{ 'REMOTE_USER' => 'goodgirl'} ),@config)
126
+ wiki.save(wikiweb,"Edited by good girl\nVersion 4")
127
+
128
+ html = wiki.diff(wikiweb,1,2)
129
+ # puts html
130
+ assert_same_markup_strings(expected_diff_with_multiple_versions,html, { "DATE" => Time.new.strftime("%d/%m/%Y") })
131
+
132
+ html = wiki.diff(wikiweb,1,3)
133
+ assert_same_markup_strings(expected_diff_with_multiple_separated_versions,html, { "DATE" => Time.new.strftime("%d/%m/%Y") })
134
+
135
+ end
136
+
137
+ def test_sidebyside
138
+ @config.close
139
+ @config = ScratchWikiConfig.new
140
+ wiki = Wiki2Go::Wiki.new(@config)
141
+
142
+ wikiweb = Wiki2Go::Web.from_request(Web2Go::MockRequest.new('http://localhost/view/Xpday/FrontPage',{ 'REMOTE_USER' => 'goodgirl'} ),@config)
143
+ wiki.save(wikiweb,"start<br>edited by *good girl & boy*\nI want a pony!")
144
+
145
+ wikiweb = Wiki2Go::Web.from_request(Web2Go::MockRequest.new('http://localhost/view/Xpday/FrontPage',{ 'REMOTE_USER' => 'goodboy'} ),@config)
146
+ wiki.save(wikiweb,"start<br />edited by *good girl & boy*\nI hate ponies!")
147
+
148
+ html = wiki.sidebyside(wikiweb,0,1)
149
+ # puts html
150
+ assert_same_markup_strings(expected_sidebyside,html, { "DATE" => Time.new.strftime("%d/%m/%Y") })
151
+
152
+ end
153
+
154
+ def test_edit
155
+ wiki = Wiki2Go::Wiki.new(@config)
156
+
157
+ wikiweb = Wiki2Go::Web.from_page_url("http://localhost/edit/Xpday/FrontPage","edit",@config)
158
+
159
+ html = wiki.edit(wikiweb)
160
+
161
+ assert_same_file_string(testdata('expected_edit.html'),scratchdata('generated_edit.html'),html)
162
+
163
+ end
164
+
165
+ def test_save
166
+ @config.close
167
+ @config = TestWiki2GoConfig.new
168
+ assert(!@config.generate_html)
169
+ wiki = Wiki2Go::Wiki.new(@config)
170
+
171
+ wikiweb = Wiki2Go::Web.from_page_url("http://localhost/view/Xpday/FrontPage","view",@config)
172
+ wiki.save(wikiweb,"FrontPage")
173
+
174
+ wikiweb = Wiki2Go::Web.from_page_url("http://localhost/view/Xpday/test","view",@config)
175
+ wikiweb.title = "FrontPagename"
176
+ redirect_url = wiki.save(wikiweb,"FrontPage")
177
+ assert_equal("http://localhost/view/Xpday/test",redirect_url)
178
+
179
+ html = wiki.view(wikiweb,-1)
180
+
181
+ assert_same_file_string(testdata('expected_save.html'),scratchdata('generated_save.html'),html, { "DATE" => Time.new.strftime("%d/%m/%Y") } )
182
+
183
+ end
184
+
185
+
186
+
187
+ def test_save_with_html
188
+ @config.close
189
+ @config = TestWiki2GoConfig.new
190
+ @config.generate_html = true
191
+
192
+ wiki = Wiki2Go::Wiki.new(@config)
193
+
194
+ wikiweb = Wiki2Go::Web.from_page_url("http://localhost/view/Xpday/FrontPage","view",@config)
195
+ wiki.save(wikiweb,"FrontPage")
196
+
197
+ wikiweb = Wiki2Go::Web.from_page_url("http://localhost/view/Xpday/test","view",@config)
198
+
199
+ root = @config.site_directory
200
+ path = File.join(root,wikiweb.name, wikiweb.current_page + ".html")
201
+ File.delete(path) if File.exists?(path)
202
+
203
+ wikiweb.title = "Frontpagename"
204
+ redirect_url = wiki.save(wikiweb,"FrontPage")
205
+ assert_equal("http://localhost/Xpday/test.html",redirect_url)
206
+
207
+ assert(File.exists?(path))
208
+ assert_same_file(testdata('expected_savehtml.html'),path, { "DATE" => Time.new.strftime("%d/%m/%Y") } )
209
+
210
+ end
211
+
212
+ def test_generate_static
213
+ @config.close
214
+ @config = PrivateTestWiki2GoConfig.new
215
+
216
+ wiki = Wiki2Go::Wiki.new(@config)
217
+
218
+ request = Web2Go::MockRequest.new('http://localhost:8088/generate_static/NonExistingWeb/FrontPage')
219
+ request.authenticated = true
220
+ request.user = 'admin'
221
+ wikiweb = Wiki2Go::Web.from_request(request,@config)
222
+ wiki.save(wikiweb,"FrontPage")
223
+ # puts wiki.generate_html(wikiweb)
224
+ end
225
+
226
+ def test_format_for_fckeditor
227
+ @config.close
228
+ @config = TestWiki2GoConfig.new
229
+ wiki = Wiki2Go::Wiki.new(@config)
230
+
231
+ wikiweb = Wiki2Go::Web.page_url("localhost","80","/save/Xpday/SimplePage","save",@config)
232
+ wikiweb.title = 'simple'
233
+ wiki.save(wikiweb,'A simple page\n')
234
+
235
+ wikiweb = Wiki2Go::Web.page_url("localhost","80","/save/Xpday/OtherPage","save",@config)
236
+ wikiweb.title = 'other'
237
+ wiki.save(wikiweb,'A simple page\n')
238
+
239
+
240
+ wikiweb = Wiki2Go::Web.from_page_url("http://localhost/admin/Xpday/","admin",@config)
241
+
242
+ html = wiki.prepare_for_fckeditor(wikiweb)
243
+
244
+ dir = @config.root_directory
245
+ assert File.exists?(File.join(dir,'texts','Xpday','OtherPage.txt'))
246
+ assert File.exists?(File.join(dir,'texts','Xpday','OtherPage.bak'))
247
+ assert File.exists?(File.join(dir,'texts','Xpday','SimplePage.txt'))
248
+ assert File.exists?(File.join(dir,'texts','Xpday','SimplePage.bak'))
249
+ end
250
+
251
+ def test_changes
252
+ wiki = Wiki2Go::Wiki.new(@config)
253
+
254
+ wikiweb = Wiki2Go::Web.page_url("localhost","80","/upload/Xpday","changes",@config)
255
+
256
+ html = wiki.changes(wikiweb)
257
+
258
+ # assert_same_file_string(testdata('expected_changes.html'),scratchdata('generated_changes.html'),html, { "DATE" => Time.new.strftime("%d/%m/%Y") })
259
+
260
+ end
261
+
262
+ def test_search
263
+ wiki = Wiki2Go::Wiki.new(@config)
264
+
265
+ wikiweb = Wiki2Go::Web.page_url("localhost","80","/search/Xpday","search",@config)
266
+
267
+ html = wiki.search(wikiweb,"Benelux")
268
+
269
+ assert_same_file_string(testdata('expected_search.html'),scratchdata('generated_search.html'),html, { "DATE" => Time.new.strftime("%d/%m/%Y") })
270
+
271
+ end
272
+
273
+ def test_upload_files
274
+ @config.close
275
+ @config = TestWiki2GoConfig.new
276
+ wiki = Wiki2Go::Wiki.new(@config)
277
+
278
+ wikiweb = Wiki2Go::Web.page_url("localhost","80","/upload/Xpday/UploadPage","upload",@config)
279
+ wikiweb.title = 'simple'
280
+ wiki.save(wikiweb,'A simple page\n')
281
+
282
+ redirect = wiki.upload(wikiweb,"brol.txt","hello peops")
283
+ assert_equal 'http://localhost/view/Xpday/UploadPage',redirect
284
+
285
+ html = wiki.view(wikiweb,-1)
286
+ assert_same_file_string(testdata('expected_upload.html'),scratchdata('generated_upload.html'),html, { "DATE" => Time.new.strftime("%d/%m/%Y") })
287
+
288
+ redirect = wiki.upload(wikiweb,'',nil)
289
+ assert_equal 'http://localhost/view/Xpday/UploadPage',redirect
290
+
291
+ html = wiki.view(wikiweb,-1)
292
+ assert_same_file_string(testdata('expected_upload.html'),scratchdata('generated_upload.html'),html, { "DATE" => Time.new.strftime("%d/%m/%Y") })
293
+
294
+ end
295
+
296
+ def test_default_admin_page
297
+ wiki = Wiki2Go::Wiki.new(TestWiki2GoConfig.new)
298
+ request = Web2Go::MockRequest.new('http://localhost/admin')
299
+
300
+ result = wiki.admin(request)
301
+
302
+ request = Web2Go::MockRequest.new('http://localhost/admin/regenerate')
303
+
304
+ result = wiki.admin(request)
305
+
306
+ end
307
+
308
+ def test_hanging_frontpage
309
+ wiki = Wiki2Go::Wiki.new(@config)
310
+
311
+ wikiweb = Wiki2Go::Web.page_url("localhost","80","/view/Bugs/FrontPage","view",@config)
312
+ # puts wiki.view(wikiweb,-1)
313
+ end
314
+
315
+ private
316
+
317
+ def expected_diff_with_multiple_versions
318
+ return <<END_EXPECTED_DIFF
319
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
320
+ <HTML>
321
+ <HEAD>
322
+ <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
323
+ <META http-equiv="Pragma" content="no-cache">
324
+ <META name="Author" content="Pascal Van Cauwenberghe">
325
+ <META name="Keywords" content="ruby,wiki">
326
+ <LINK rel="stylesheet" href="/html/Xpday/style.css" type="text/css">
327
+ <LINK rel="alternate" type="application/rss+xml" title="RSS 2.0 feed" href="/html/Xpday/rss.xml">
328
+ <TITLE>
329
+
330
+ Xpday
331
+ -
332
+
333
+ FrontPage
334
+ </TITLE>
335
+ </HEAD>
336
+ <BODY>
337
+ <table id="container">
338
+ <tr>
339
+ <td colspan="2" id="header">
340
+ <TABLE border="0" cellpadding="0" cellspacing="0" width="95%" class="Header">
341
+ <TR>
342
+ <TD><h1><a href="/search/Xpday?text=FrontPage" rel="nofollow">FrontPage</a>
343
+
344
+ <a href="/view/Xpday/FrontPage">v.2</a>
345
+
346
+ </h1>
347
+ </TD>
348
+ <td align="right"><a href="/view/Xpday/FrontPage">Home</a></td>
349
+ </TR>
350
+ </TABLE>
351
+ </td>
352
+ </tr>
353
+ <tr>
354
+ <td id="menu" valign="top" nowrap>
355
+
356
+ <ul>
357
+ <li>
358
+ <a href="/versions/Xpday/FrontPage" rel="nofollow">Page&nbsp;History</a>
359
+ </li>
360
+
361
+ <li>
362
+ <a href="/sidebyside/Xpday/FrontPage?from=1&amp;to=2" rel="nofollow">What&nbsp;changed?</a>
363
+ </li>
364
+
365
+ <li>
366
+ <a href="/diff/Xpday/FrontPage?from=1&amp;to=2" rel="nofollow">Diff</a>
367
+ </li>
368
+ <li>
369
+ <a href="/wikiedit/Xpday/FrontPage" rel="nofollow">Edit&nbsp;this&nbsp;page</a>
370
+ </li>
371
+ </ul>
372
+ <hr>
373
+
374
+ <ul>
375
+ <li>
376
+ <a href="/changes/Xpday" rel="nofollow">Recent&nbsp;changes</a>
377
+ </li>
378
+ <li>
379
+ <a href="/html/Xpday/rss.xml"><img src="/html/rssLogo.png" width="36" height="14" border="0" alt="Keep up to date"></a>
380
+ </li>
381
+ </ul>
382
+ </td>
383
+ <td id="body" width="100%" valign="top">
384
+ <strong>FrontPage <a href="/diff/Xpday/FrontPage?from=0&amp;to=2" rel="nofollow">&lt;&lt;</a> <a href="/view/Xpday/FrontPage?version=1">v1 (by goodboy)</a> => <a href="/view/Xpday/FrontPage?version=2">v2 (by goodgirl)</a> <a href="/diff/Xpday/FrontPage?from=1&amp;to=3" rel="nofollow">&gt;&gt;</a></strong>
385
+ <hr>
386
+
387
+ <div class=\"diff_deleted\">&lt;&nbsp;Edited&nbsp;by&nbsp;good&nbsp;boy</div>
388
+ <div class=\"diff_added\">&gt;&nbsp;Edited&nbsp;by&nbsp;good&nbsp;girl</div>
389
+ <div class=\"diff_deleted\">&lt;&nbsp;Version&nbsp;1</div>
390
+ <div class=\"diff_added\">&gt;&nbsp;Version&nbsp;2</div>
391
+ </td>
392
+ </tr>
393
+ <tr>
394
+ <td colspan="2" id="footer">
395
+ <TABLE border="0" cellpadding="0" cellspacing="0" width="100%" class="Footer">
396
+ <TR>
397
+ <TD width="50%">
398
+
399
+ <a href="/sidebyside/Xpday/FrontPage?from=1&amp;to=2" rel="nofollow">Changed</a>
400
+ on
401
+ DATE
402
+ by
403
+ <a href="/search/Xpday?text=goodgirl" rel="nofollow">goodgirl</a>
404
+
405
+ </TD>
406
+ <TD width="50%" align="right">
407
+ Contact the site administrator:
408
+ <a href="/view/Xpday/MailFormattingRules" rel="nofollow" onmouseover="this.href='mai' + 'lto:' + 'wiki2go' + '&#64;' + 'nayima.be'">wiki2go</a>
409
+ </TD>
410
+ </TR>
411
+ <tr><td colspan="2"><hr></td></tr>
412
+ <tr>
413
+ <td><FORM action="/search/Xpday" method="post" id="search" name="search">
414
+ Search for <INPUT name="text" size="30" ID="Text1"> <input type="submit" name="Go" value="Go">
415
+ </FORM>
416
+ </td>
417
+ <td>
418
+
419
+ </td>
420
+ </tr>
421
+ </TABLE>
422
+ </td>
423
+ </tr>
424
+ </table>
425
+ <span style="float:right">
426
+ <a target="_blank" href="http://validator.w3.org/check?uri=http://localhost/view/Xpday/FrontPage">
427
+ <img border="0" src="/html/valid-html401.png" alt="Verify if layout is correct!" height="31" width="88"></a>
428
+ </span>
429
+ </BODY>
430
+ </HTML>
431
+ END_EXPECTED_DIFF
432
+ end
433
+
434
+ def expected_diff_with_multiple_separated_versions
435
+ return <<END_EXPECTED_DIFF
436
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
437
+ <HTML>
438
+ <HEAD>
439
+ <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
440
+ <META http-equiv="Pragma" content="no-cache">
441
+ <META name="Author" content="Pascal Van Cauwenberghe">
442
+ <META name="Keywords" content="ruby,wiki">
443
+ <LINK rel="stylesheet" href="/html/Xpday/style.css" type="text/css">
444
+ <LINK rel="alternate" type="application/rss+xml" title="RSS 2.0 feed" href="/html/Xpday/rss.xml">
445
+ <TITLE>
446
+
447
+ Xpday
448
+ -
449
+
450
+ FrontPage
451
+ </TITLE>
452
+ </HEAD>
453
+ <BODY>
454
+ <table id="container">
455
+ <tr>
456
+ <td colspan="2" id="header">
457
+ <TABLE border="0" cellpadding="0" cellspacing="0" width="95%" class="Header">
458
+ <TR>
459
+ <TD><h1><a href="/search/Xpday?text=FrontPage" rel="nofollow">FrontPage</a>
460
+
461
+ <a href="/view/Xpday/FrontPage">v.3</a>
462
+
463
+ </h1>
464
+ </TD>
465
+ <td align="right"><a href="/view/Xpday/FrontPage">Home</a></td>
466
+ </TR>
467
+ </TABLE>
468
+ </td>
469
+ </tr>
470
+ <tr>
471
+ <td id="menu" valign="top" nowrap>
472
+
473
+ <ul>
474
+ <li>
475
+ <a href="/versions/Xpday/FrontPage" rel="nofollow">Page&nbsp;History</a>
476
+ </li>
477
+
478
+ <li>
479
+ <a href="/sidebyside/Xpday/FrontPage?from=1&amp;to=3" rel="nofollow">What&nbsp;changed?</a>
480
+ </li>
481
+
482
+ <li>
483
+ <a href="/diff/Xpday/FrontPage?from=1&amp;to=3" rel="nofollow">Diff</a>
484
+ </li>
485
+ <li>
486
+ <a href="/wikiedit/Xpday/FrontPage" rel="nofollow">Edit&nbsp;this&nbsp;page</a>
487
+ </li>
488
+ </ul>
489
+ <hr>
490
+
491
+ <ul>
492
+ <li>
493
+ <a href="/changes/Xpday" rel="nofollow">Recent&nbsp;changes</a>
494
+ </li>
495
+ <li>
496
+ <a href="/html/Xpday/rss.xml"><img src="/html/rssLogo.png" width="36" height="14" border="0" alt="Keep up to date"></a>
497
+ </li>
498
+ </ul>
499
+ </td>
500
+ <td id="body" width="100%" valign="top">
501
+ <strong>FrontPage <a href="/diff/Xpday/FrontPage?from=0&amp;to=3" rel="nofollow">&lt;&lt;</a> <a href="/view/Xpday/FrontPage?version=1">v1 (by goodboy)</a> <a href="/diff/Xpday/FrontPage?from=2&amp;to=3" rel="nofollow">&gt;&gt;</a> => <a href="/diff/Xpday/FrontPage?from=1&amp;to=2" rel="nofollow">&lt;&lt;</a> <a href="/view/Xpday/FrontPage?version=3">v3 (by goodboy)</a> <a href="/diff/Xpday/FrontPage?from=1&amp;to=4" rel="nofollow">&gt;&gt;</a></strong>
502
+ <hr>
503
+
504
+ <div class=\"diff_kept\">=&nbsp;Edited&nbsp;by&nbsp;good&nbsp;boy</div>
505
+ <div class=\"diff_deleted\">&lt;&nbsp;Version&nbsp;1</div>
506
+ <div class=\"diff_added\">&gt;&nbsp;Version&nbsp;3</div>
507
+ </td>
508
+ </tr>
509
+ <tr>
510
+ <td colspan="2" id="footer">
511
+ <TABLE border="0" cellpadding="0" cellspacing="0" width="100%" class="Footer">
512
+ <TR>
513
+ <TD width="50%">
514
+
515
+ <a href="/sidebyside/Xpday/FrontPage?from=1&amp;to=3" rel="nofollow">Changed</a>
516
+ on
517
+ DATE
518
+ by
519
+ <a href="/search/Xpday?text=goodboy" rel="nofollow">goodboy</a>
520
+
521
+ </TD>
522
+ <TD width="50%" align="right">
523
+ Contact the site administrator:
524
+ <a href="/view/Xpday/MailFormattingRules" rel="nofollow" onmouseover="this.href='mai' + 'lto:' + 'wiki2go' + '&#64;' + 'nayima.be'">wiki2go</a>
525
+ </TD>
526
+ </TR>
527
+ <tr><td colspan="2"><hr></td></tr>
528
+ <tr>
529
+ <td><FORM action="/search/Xpday" method="post" id="search" name="search">
530
+ Search for <INPUT name="text" size="30" ID="Text1"> <input type="submit" name="Go" value="Go">
531
+ </FORM>
532
+ </td>
533
+ <td>
534
+
535
+ </td>
536
+ </tr>
537
+ </TABLE>
538
+ </td>
539
+ </tr>
540
+ </table>
541
+ <span style="float:right">
542
+ <a target="_blank" href="http://validator.w3.org/check?uri=http://localhost/view/Xpday/FrontPage">
543
+ <img border="0" src="/html/valid-html401.png" alt="Verify if layout is correct!" height="31" width="88"></a>
544
+ </span>
545
+ </BODY>
546
+ </HTML>
547
+ END_EXPECTED_DIFF
548
+ end
549
+
550
+ def expected_diff
551
+ return <<END_EXPECTED_DIFF
552
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
553
+ <HTML>
554
+ <HEAD>
555
+ <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
556
+ <META http-equiv="Pragma" content="no-cache">
557
+ <META name="Author" content="Pascal Van Cauwenberghe">
558
+ <META name="Keywords" content="ruby,wiki">
559
+ <LINK rel="stylesheet" href="/html/Xpday/style.css" type="text/css">
560
+ <LINK rel="alternate" type="application/rss+xml" title="RSS 2.0 feed" href="/html/Xpday/rss.xml">
561
+ <TITLE>
562
+
563
+ Xpday
564
+ -
565
+
566
+ FrontPage
567
+ </TITLE>
568
+ </HEAD>
569
+ <BODY>
570
+ <table id="container">
571
+ <tr>
572
+ <td colspan="2" id="header">
573
+ <TABLE border="0" cellpadding="0" cellspacing="0" width="95%" class="Header">
574
+ <TR>
575
+ <TD><h1><a href="/search/Xpday?text=FrontPage" rel="nofollow">FrontPage</a>
576
+
577
+ <a href="/view/Xpday/FrontPage">v.1</a>
578
+
579
+ </h1>
580
+ </TD>
581
+ <td align="right"><a href="/view/Xpday/FrontPage">Home</a></td>
582
+ </TR>
583
+ </TABLE>
584
+ </td>
585
+ </tr>
586
+ <tr>
587
+ <td id="menu" valign="top" nowrap>
588
+
589
+ <ul>
590
+ <li>
591
+ <a href="/versions/Xpday/FrontPage" rel="nofollow">Page&nbsp;History</a>
592
+ </li>
593
+
594
+ <li>
595
+ <a href="/sidebyside/Xpday/FrontPage?from=0&amp;to=1" rel="nofollow">What&nbsp;changed?</a>
596
+ </li>
597
+
598
+ <li>
599
+ <a href="/diff/Xpday/FrontPage?from=0&amp;to=1" rel="nofollow">Diff</a>
600
+ </li>
601
+ <li>
602
+ <a href="/wikiedit/Xpday/FrontPage" rel="nofollow">Edit&nbsp;this&nbsp;page</a>
603
+ </li>
604
+
605
+ </ul>
606
+ <hr>
607
+
608
+ <ul>
609
+ <li>
610
+ <a href="/changes/Xpday" rel="nofollow">Recent&nbsp;changes</a>
611
+ </li>
612
+ <li>
613
+ <a href="/html/Xpday/rss.xml"><img src="/html/rssLogo.png" width="36" height="14" border="0" alt="Keep up to date"></a>
614
+ </li>
615
+ </ul>
616
+ </td>
617
+ <td id="body" width="100%" valign="top">
618
+ <strong>FrontPage <a href="/view/Xpday/FrontPage?version=0">v0 (by goodgirl)</a> => <a href="/view/Xpday/FrontPage?version=1">v1 (by goodboy)</a> <a href="/diff/Xpday/FrontPage?from=0&amp;to=2" rel="nofollow">&gt;&gt;</a></strong>
619
+ <hr>
620
+
621
+ <div class="diff_kept">=&nbsp;start</div>
622
+ <div class="diff_kept">=&nbsp;edited&nbsp;by&nbsp;*good&nbsp;girl&nbsp;&amp;&nbsp;boy*</div>
623
+ <div class="diff_deleted">&lt;&nbsp;I&nbsp;want&nbsp;a&nbsp;pony!</div>
624
+ <div class="diff_added">&gt;&nbsp;I&nbsp;hate&nbsp;ponies!</div>
625
+ </td>
626
+ </tr>
627
+ <tr>
628
+ <td colspan="2" id="footer">
629
+ <TABLE border="0" cellpadding="0" cellspacing="0" width="100%" class="Footer">
630
+ <TR>
631
+ <TD width="50%">
632
+
633
+ <a href="/sidebyside/Xpday/FrontPage?from=0&amp;to=1" rel="nofollow">Changed</a>
634
+ on
635
+ DATE
636
+ by
637
+ <a href="/search/Xpday?text=goodboy" rel="nofollow">goodboy</a>
638
+
639
+ </TD>
640
+ <TD width="50%" align="right">
641
+ Contact the site administrator:
642
+ <a href="/view/Xpday/MailFormattingRules" rel="nofollow" onmouseover="this.href='mai' + 'lto:' + 'wiki2go' + '&#64;' + 'nayima.be'">wiki2go</a>
643
+ </TD>
644
+ </TR>
645
+ <tr><td colspan="2"><hr></td></tr>
646
+ <tr>
647
+ <td><FORM action="/search/Xpday" method="post" id="search" name="search">
648
+ Search for <INPUT name="text" size="30" ID="Text1"> <input type="submit" name="Go" value="Go">
649
+ </FORM>
650
+ </td>
651
+ <td>
652
+
653
+ </td>
654
+ </tr>
655
+ </TABLE>
656
+ </td>
657
+ </tr>
658
+ </table>
659
+ <span style="float:right">
660
+ <a target="_blank" href="http://validator.w3.org/check?uri=http://localhost/view/Xpday/FrontPage">
661
+ <img border="0" src="/html/valid-html401.png" alt="Verify if layout is correct!" height="31" width="88"></a>
662
+ </span>
663
+ </BODY>
664
+ </HTML>
665
+ END_EXPECTED_DIFF
666
+ end
667
+
668
+ def expected_sidebyside
669
+ return <<END_EXPECTED_SIDEBYSIDE
670
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
671
+ <HTML>
672
+ <HEAD>
673
+ <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
674
+ <META http-equiv="Pragma" content="no-cache">
675
+ <META name="Author" content="Pascal Van Cauwenberghe">
676
+ <META name="Keywords" content="ruby,wiki">
677
+ <LINK rel="stylesheet" href="/html/Xpday/style.css" type="text/css">
678
+ <LINK rel="alternate" type="application/rss+xml" title="RSS 2.0 feed" href="/html/Xpday/rss.xml">
679
+ <TITLE>
680
+
681
+ Xpday
682
+ -
683
+
684
+ FrontPage
685
+ </TITLE>
686
+ </HEAD>
687
+ <BODY>
688
+ <table id="container">
689
+ <tr>
690
+ <td colspan="2" id="header">
691
+ <TABLE border="0" cellpadding="0" cellspacing="0" width="95%" class="Header">
692
+ <TR>
693
+ <TD><h1><a href="/search/Xpday?text=FrontPage" rel="nofollow">FrontPage</a>
694
+
695
+ <a href="/view/Xpday/FrontPage">v.1</a>
696
+
697
+ </h1>
698
+ </TD>
699
+ <td align="right"><a href="/view/Xpday/FrontPage">Home</a></td>
700
+ </TR>
701
+ </TABLE>
702
+ </td>
703
+ </tr>
704
+ <tr>
705
+ <td id="menu" valign="top" nowrap>
706
+
707
+ <ul>
708
+ <li>
709
+ <a href="/versions/Xpday/FrontPage" rel="nofollow">Page&nbsp;History</a>
710
+ </li>
711
+
712
+ <li>
713
+ <a href="/sidebyside/Xpday/FrontPage?from=0&amp;to=1" rel="nofollow">What&nbsp;changed?</a>
714
+ </li>
715
+
716
+ <li>
717
+ <a href="/diff/Xpday/FrontPage?from=0&amp;to=1" rel="nofollow">Diff</a>
718
+ </li>
719
+ <li>
720
+ <a href="/wikiedit/Xpday/FrontPage" rel="nofollow">Edit&nbsp;this&nbsp;page</a>
721
+ </li>
722
+ </ul>
723
+ <hr>
724
+
725
+ <ul>
726
+ <li>
727
+ <a href="/changes/Xpday" rel="nofollow">Recent&nbsp;changes</a>
728
+ </li>
729
+ <li>
730
+ <a href="/html/Xpday/rss.xml"><img src="/html/rssLogo.png" width="36" height="14" border="0" alt="Keep up to date"></a>
731
+ </li>
732
+ </ul>
733
+ </td>
734
+ <td id="body" width="100%" valign="top">
735
+ <table class="wikitable" width="100%"><tr><th><a href="/view/Xpday/FrontPage?version=0">FrontPage v0 (by goodgirl)</a></th><th><a href="/view/Xpday/FrontPage?version=1">FrontPage v1 (by goodboy)</a> <a href=\"/sidebyside/Xpday/FrontPage?from=0&amp;to=2\" rel="nofollow">&gt;&gt;</a></th></tr>
736
+ <tr><td width='50%' valign='top'>start<br>edited by <STRONG>good girl &amp; boy</STRONG>
737
+ I want a pony!</td><td width='50%' valign='top'>start<br />edited by <STRONG>good girl &amp; boy</STRONG>
738
+ I hate ponies!</td></tr></table>
739
+ </td>
740
+ </tr>
741
+ <tr>
742
+ <td colspan="2" id="footer">
743
+ <TABLE border="0" cellpadding="0" cellspacing="0" width="100%" class="Footer">
744
+ <TR>
745
+ <TD width="50%">
746
+
747
+ <a href="/sidebyside/Xpday/FrontPage?from=0&amp;to=1" rel="nofollow">Changed</a>
748
+ on
749
+ DATE
750
+ by
751
+ <a href="/search/Xpday?text=goodboy" rel="nofollow">goodboy</a>
752
+
753
+ </TD>
754
+ <TD width="50%" align="right">
755
+ Contact the site administrator:
756
+ <a href="/view/Xpday/MailFormattingRules" rel="nofollow" onmouseover="this.href='mai' + 'lto:' + 'wiki2go' + '&#64;' + 'nayima.be'">wiki2go</a>
757
+ </TD>
758
+ </TR>
759
+ <tr><td colspan="2"><hr></td></tr>
760
+ <tr>
761
+ <td><FORM action="/search/Xpday" method="post" id="search" name="search">
762
+ Search for <INPUT name="text" size="30" ID="Text1"> <input type="submit" name="Go" value="Go">
763
+ </FORM>
764
+ </td>
765
+ <td>
766
+
767
+ </td>
768
+ </tr>
769
+ </TABLE>
770
+ </td>
771
+ </tr>
772
+ </table>
773
+ <span style="float:right">
774
+ <a target="_blank" href="http://validator.w3.org/check?uri=http://localhost/view/Xpday/FrontPage">
775
+ <img border="0" src="/html/valid-html401.png" alt="Verify if layout is correct!" height="31" width="88"></a>
776
+ </span>
777
+ </BODY>
778
+ </HTML>
779
+ END_EXPECTED_SIDEBYSIDE
780
+ end
781
+
782
+
783
+
184
784
  end