class TestGroupSite
Public Instance Methods
setup_group()
click to toggle source
# File vendor/qwik/lib/qwik/group-site.rb, line 205 def setup_group return QuickML::Group.new(@ml_config, 'test@example.com') end
test_all()
click to toggle source
# File vendor/qwik/lib/qwik/group-site.rb, line 216 def test_all c = QuickML::GroupSite group = setup_group t_make_readable(QuickML::Group, :groupsite) groupsite = group.groupsite # test_key eq nil, groupsite.key # test_make_content message = 'Date: Mon, 3 Feb 2001 12:34:56 +0900 From: user@e.com To: test@example.com Subject: test test. ' t_make_public(QuickML::GroupSite, :make_content) mail = QuickML::Mail.generate { message } eq "{{mail(user@e.com,0)\ntest.\n}}\n", groupsite.make_content(nil, mail, Time.at(0)) # test_attach eq ' {{file(t.txt)}} ', c.attach(@site, 'FrontPage', 't.txt', 'test.') files = @site.files('FrontPage') eq true, files.exist?('t.txt') eq ['t.txt'], files.list # test_attach_again eq ' {{file(1-t.txt)}} ', c.attach(@site, 'FrontPage', 't.txt', 'test.') eq true, files.exist?('1-t.txt') eq ['1-t.txt', 't.txt'], files.list # test_page_url t_make_public(QuickML::Group, :page_url) eq 'http://example.com/test/', group.page_url groupsite.instance_eval { @key = 't' } eq 'http://example.com/test/t.html', group.page_url # test_attach eq ' {{file(あ.txt)}} ', c.attach(@site, 'FrontPage', 'あ.txt', 'test.') eq true, files.exist?('t.txt') #eq true, files.exist?('=82=A0.txt') #eq ['1-t.txt', '=82=A0.txt', 't.txt'], files.list end
test_class_method()
click to toggle source
# File vendor/qwik/lib/qwik/group-site.rb, line 209 def test_class_method c = QuickML::GroupSite # test_file_with_num eq '1-t', c.file_with_num('t', 1) end
test_total_file_limit()
click to toggle source
# File vendor/qwik/lib/qwik/group-site.rb, line 279 def test_total_file_limit c = QuickML::GroupSite group = setup_group t_make_readable(QuickML::Group, :groupsite) groupsite = group.groupsite #attach 712B file named 'ruby.png' multi_part_message = 'Date: Tue, 13 Jan 2009 21:51:41 +0900 From: user@e.com To: test@example.com Subject: test Content-Type: multipart/mixed; boundary="Multipart_Tue_Jan_13_21:58:38_2009-1" --Multipart_Tue_Jan_13_21:58:38_2009-1 Content-Type: text/plain; charset=US-ASCII ruby --Multipart_Tue_Jan_13_21:58:38_2009-1 Content-Type: image/png Content-Disposition: inline; filename="ruby.png" Content-Transfer-Encoding: base64 iVBORw0KGgoAAAANSUhEUgAAAA4AAAAQCAIAAACp9tltAAAAAXNSR0IArs4c6QAAAoJJREFUKM8F wUlPE1EAAOC3zXSWbtMylBbaAEUsEKlQIkSlogkxRm9eSLx78Z94NSR6MzEuF42JejUx0URNMFAo RUJtEUqBCp1pO0unM+/5ffBxfum8XMaSbBsGkWSPUQqA03UoAIAQj1IAodE2cvfu4KU+Nf9gJdKv Dgyn9GJRxhjqWvbmjWQq1S4UFMEXQhBalokwMXRdGRk53NoeXpg/2ipKStgxTCJJA5MTWu0QEeJZ Fg6HWxjjqyFlLDcTHUsfbRQwxyWy06FEghN8Xq/Xn7mYXlyUlPB5rWZQhgDGsqoW3r1P5mbFcFgI BXm/zChzTKu2vr726nU0PXr+p0o4jjCEvj5ZbVT3TU33q31G4xRh7FgWdT29dgQRKn74yDyPIESs VrsF2MTt5cHhZGw8bRta8dNn5guKgaDV1Ox2+7j0GxMMAUPB5ODcyn3QqO++eL79dDW9fLdvPndQ KNT/VuO5LLUsSD2CEIIQX4vF7NLmWWUfCgIRJUi7zW9fui4oN/7F4nF4ckwwRJ7LIlHUOv3XdRw+ qrSbWmBy+mCjdHLaCfqD2Xxejcc41xIJFDHjEEQMY8jzRrOpZi/NP3rYYsgR5UrjTFYiEYHDXlck QCKAQ5B4jLV0LZGZmLyeq755ptfrtb09JEu0Y3WOagGZI4RxPLMJIE7PHbqVT4VDWy/fYp8ojWda rjs1O+M2dey2RR5gjjKXmRigyFAiMze39/OX4490bNozrJGFK/rJMXJtwTVFHokEiBwQOYSnMN8q 7XQs2wTAJFhNj2KO7Hz/cXlmKqZVcM8UOSgxx/ZHSCSZKlf3BdHn2QaDQF/bQJQCKbS5W6lblNCA ADFPoXIh8x8NLS3ZvcTDhQAAAABJRU5ErkJggg== --Multipart_Tue_Jan_13_21:58:38_2009-1-- ' default_max_total_file_size = @config[:max_total_file_size] default_max_total_warn_size = @config[:max_total_warn_size] @config[:max_total_file_size] = 800 #total file size limit @config[:max_total_warn_size] = 100 #warn if remaining is less than this t_make_writable(QuickML::GroupSite, :total_file_size_exceeded) t_make_writable(QuickML::GroupSite, :total_file_size_reaching) mail = QuickML::Mail.generate { multi_part_message } ##post first mail groupsite.post(mail) files = @site.files('test') #check if attached file is saved on the web eq ['ruby.png'], files.list #check if warning is on eq true, groupsite.total_file_size_reaching ##post second mail groupsite.total_file_size_reaching = false groupsite.post(mail) # check if attached file is save on the web eq ['1-ruby.png','ruby.png'], files.list #check if total file size is exceeded the limit(800) eq true, groupsite.total_file_size_exceeded ##post second mail groupsite.total_file_size_exceeded = false groupsite.post(mail) #check if file is not attached eq ['1-ruby.png','ruby.png'], files.list #check if total file size is exceeded the limit(800) eq true, groupsite.total_file_size_exceeded #check if the warning message is inserted on the web eq "{{mail(user@e.com,0)\nruby\n\n\n{{file(ruby.png)}}\n}}\n{{mail(user@e.com,0)\nruby\n\n\n{{file(1-ruby.png)}}\n}}\n{{mail(user@e.com,0)\nruby\n\n\nFile 'ruby.png' was not attached.\n}}\n", @site['test'].get_body @config[:max_total_file_size] = default_max_total_file_size @config[:max_total_warn_size] = default_max_total_warn_size end