summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-16 00:26:03 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-16 00:26:03 +0200
commit89c7df164b73748cd5c129ec9599cadfbb938eb6 (patch)
tree3b4ffa2616a000b6152ce4b0af2e8b980f1f97fc
parentf892d2340b2d7f5386fc7cf78495fdb05ad59a04 (diff)
downloadfeed2imap-89c7df164b73748cd5c129ec9599cadfbb938eb6.tar.gz
feed2imap-89c7df164b73748cd5c129ec9599cadfbb938eb6.tar.bz2
feed2imap-89c7df164b73748cd5c129ec9599cadfbb938eb6.zip
No more (obsolete) tests
-rw-r--r--test/maildir/cur/1376317520.15784_1.debian:2,S11
-rw-r--r--test/maildir/cur/1376317520.15789_1.debian:2,S11
-rw-r--r--test/maildir/cur/1376319137.17850_1.debian:2,11
-rw-r--r--test/maildir/cur/1376320022.18396_5.debian:2,FS11
-rw-r--r--test/maildir/new/1376320099.18396_7.debian11
-rwxr-xr-xtest/tc_cache.rb82
-rwxr-xr-xtest/tc_config.rb113
-rwxr-xr-xtest/tc_httpfetcher.rb72
-rw-r--r--test/tc_maildir.rb97
9 files changed, 0 insertions, 419 deletions
diff --git a/test/maildir/cur/1376317520.15784_1.debian:2,S b/test/maildir/cur/1376317520.15784_1.debian:2,S
deleted file mode 100644
index fc6aaab..0000000
--- a/test/maildir/cur/1376317520.15784_1.debian:2,S
+++ /dev/null
@@ -1,11 +0,0 @@
-Date: Mon, 12 Aug 2013 16:25:20 +0200
-From: Antonio Terceiro <terceiro@debian.org>
-To: terceiro@debian.org
-Subject: UTF-8 data: =?iso-8859-1?B?4ent8/o=?=
-Message-ID: <regular-message-id@debian.org>
-MIME-Version: 1.0
-Content-Type: text/plain; charset=us-ascii
-Content-Disposition: inline
-User-Agent: Mutt/1.5.21 (2010-09-15)
-
-This is a sample email
diff --git a/test/maildir/cur/1376317520.15789_1.debian:2,S b/test/maildir/cur/1376317520.15789_1.debian:2,S
deleted file mode 100644
index 09df924..0000000
--- a/test/maildir/cur/1376317520.15789_1.debian:2,S
+++ /dev/null
@@ -1,11 +0,0 @@
-Date: Mon, 12 Aug 2013 16:25:20 +0200
-From: Antonio Terceiro <terceiro@debian.org>
-To: terceiro@debian.org
-Subject: UTF-8 data: =?iso-8859-1?B?4ent8/o=?=
-Message-ID: <regular-message-id-2@debian.org>
-MIME-Version: 1.0
-Content-Type: text/plain; charset=us-ascii
-Content-Disposition: inline
-User-Agent: Mutt/1.5.21 (2010-09-15)
-
-This is a sample email
diff --git a/test/maildir/cur/1376319137.17850_1.debian:2, b/test/maildir/cur/1376319137.17850_1.debian:2,
deleted file mode 100644
index 0bff46a..0000000
--- a/test/maildir/cur/1376319137.17850_1.debian:2,
+++ /dev/null
@@ -1,11 +0,0 @@
-Date: Mon, 12 Aug 2013 16:52:17 +0200
-From: Antonio Terceiro <terceiro@debian.org>
-To: terceiro@debian.org
-Subject: an unread message
-Message-ID: <unread-message-id@debian.org>
-MIME-Version: 1.0
-Content-Type: text/plain; charset=us-ascii
-Content-Disposition: inline
-User-Agent: Mutt/1.5.21 (2010-09-15)
-
-This message was not read yet
diff --git a/test/maildir/cur/1376320022.18396_5.debian:2,FS b/test/maildir/cur/1376320022.18396_5.debian:2,FS
deleted file mode 100644
index 2547416..0000000
--- a/test/maildir/cur/1376320022.18396_5.debian:2,FS
+++ /dev/null
@@ -1,11 +0,0 @@
-Date: Mon, 12 Aug 2013 17:07:02 +0200
-From: Antonio Terceiro <terceiro@debian.org>
-To: terceiro@debian.org
-Subject: a flagged message
-Message-ID: <flagged-message-id@debian.org>
-MIME-Version: 1.0
-Content-Type: text/plain; charset=us-ascii
-Content-Disposition: inline
-User-Agent: Mutt/1.5.21 (2010-09-15)
-
-This message is flagged.
diff --git a/test/maildir/new/1376320099.18396_7.debian b/test/maildir/new/1376320099.18396_7.debian
deleted file mode 100644
index ba54ddd..0000000
--- a/test/maildir/new/1376320099.18396_7.debian
+++ /dev/null
@@ -1,11 +0,0 @@
-Date: Mon, 12 Aug 2013 17:08:19 +0200
-From: Antonio Terceiro <terceiro@debian.org>
-To: terceiro@debian.org
-Subject: a new message
-Message-ID: <new-message-id@debian.org>
-MIME-Version: 1.0
-Content-Type: text/plain; charset=us-ascii
-Content-Disposition: inline
-User-Agent: Mutt/1.5.21 (2010-09-15)
-
-This message is new
diff --git a/test/tc_cache.rb b/test/tc_cache.rb
deleted file mode 100755
index 9877941..0000000
--- a/test/tc_cache.rb
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/ruby -w
-
-$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
-
-require 'test/unit'
-require 'feed2imap/cache'
-require 'feedparser'
-require 'pp'
-
-class ItemCacheTest < Test::Unit::TestCase
- def test_create
- cache = ItemCache::new
- assert(! cache.nil?)
- end
-
- def test_cache_lastcheck
- cache = ItemCache::new
- assert_equal(Time::at(0), cache.get_last_check('coucou'))
- t = Time::now
- cache.set_last_check('coucou', t)
- assert_equal(t, cache.get_last_check('coucou'))
- end
-
- def test_cache_management
- c = ItemCache::new
- assert_equal(0, c.nbchannels)
- assert_equal(0, c.nbitems)
- i1 = FeedParser::FeedItem::new
- i1.title = 'title1'
- i1.link = 'link1'
- i1.content = 'content1'
- i2 = FeedParser::FeedItem::new
- i2.title = 'title2'
- i2.link = 'link2'
- i2.content = 'content2'
- i3 = FeedParser::FeedItem::new
- i3.title = 'title3'
- i3.link = 'link3'
- i3.content = 'content3'
- assert_equal([i1, i2], c.get_new_items('id', [i1, i2])[0])
- c.commit_cache('id')
- assert_equal(2, c.nbitems)
- assert_equal([i3], c.get_new_items('id', [i2, i3])[0])
- end
-
- def test_cache_management_updated
- c = ItemCache::new
- assert_equal(0, c.nbchannels)
- assert_equal(0, c.nbitems)
- i1 = FeedParser::FeedItem::new
- i1.title = 'title1'
- i1.link = 'link1'
- i1.content = 'content1'
- i2 = FeedParser::FeedItem::new
- i2.title = 'title2'
- i2.link = 'link2'
- i2.content = 'content2'
- news = c.get_new_items('id', [i1, i2])[0]
- assert_equal([i1, i2], news)
- idx1 = i1.cacheditem.index
- assert_equal(0, idx1)
- idx2 = i2.cacheditem.index
- assert_equal(1, idx2)
- c.commit_cache('id')
- i3 = FeedParser::FeedItem::new
- i3.title = 'title 1 - updated'
- i3.link = 'link1'
- i3.content = 'content1'
- news, updated = c.get_new_items('id', [i3])
- assert_equal([], news)
- assert_equal([i3], updated)
- assert_equal(idx1, i3.cacheditem.index)
- i4 = FeedParser::FeedItem::new
- i4.title = 'title 1 - updated'
- i4.link = 'link1'
- i4.content = 'content1 - modified'
- news, updated = c.get_new_items('id', [i4])
- assert_equal([], news)
- assert_equal([i4], updated)
- assert_equal(idx1, i4.cacheditem.index)
- end
-end
diff --git a/test/tc_config.rb b/test/tc_config.rb
deleted file mode 100755
index 8d5353c..0000000
--- a/test/tc_config.rb
+++ /dev/null
@@ -1,113 +0,0 @@
-#!/usr/bin/ruby -w
-
-$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
-
-require 'test/unit'
-require 'feed2imap/config'
-require 'stringio'
-
-CONF1 = <<EOF
-cache: /home/lucas/.feed2imap_cachedatabase
-feeds:
- - name: feed1
- url: http://something
- target: imap://login:pasword@ezaezae/Feeds/A
- - name: feed2
- url: http://something2
- target: imap://login:pasword@ezaezae/Feeds/B
-EOF
-CONF2 = <<EOF
-feeds:
- - name: feed1
- url: http://something
- target: imap://login:pasword@ezaezae/Feeds/A
- - name: feed2
- url: http://something2
- target: imaps://login:pasword@ezaezae/Feeds/B
-EOF
-CONFFEED = <<EOF
-feeds:
- - name: feed1
- url: feed:http://something
- target: imap://login:pasword@ezaezae/Feeds/A
- - name: feed2
- url: http://something2
- target: imaps://login:pasword@ezaezae/Feeds/B
-EOF
-CONFPARTS = <<EOF
-parts: text
-include-images: false
-feeds:
- - name: feed1
- url: http://something
- target: imap://login:pasword@ezaezae/Feeds/A
- - name: feed2
- url: http://something2
- target: imap://login:pasword@ezaezae/Feeds/B
-EOF
-CONFARRAYTARGET = <<EOF
-parts: text
-include-images: false
-prefix: &target "maildir:///tmp/Maildir/"
-feeds:
- - name: feed1
- url: http://something
- target: [ *target, "feed1" ]
-EOF
-CONFINTNAME = <<EOF
-parts: text
-include-images: false
-prefix: &target "maildir:///tmp/Maildir/"
-feeds:
- - name: 10
- url: http://something
- target: [ *target, "feed1" ]
-EOF
-
-class ConfigTest < Test::Unit::TestCase
- def test_cache
- sio = StringIO::new CONF1
- conf = F2IConfig::new(sio)
- assert_equal('/home/lucas/.feed2imap_cachedatabase', conf.cache)
- # testing default value
- sio = StringIO::new CONF2
- conf = F2IConfig::new(sio)
- assert_equal(ENV['HOME'] + '/.feed2imap.cache', conf.cache)
- end
-
- def test_accounts
- sio = StringIO::new CONF1
- conf = F2IConfig::new(sio)
- assert_equal(1, conf.imap_accounts.length)
- sio = StringIO::new CONF2
- conf = F2IConfig::new(sio)
- assert_equal(2, conf.imap_accounts.length)
- end
-
- def test_feedurls
- sio = StringIO::new CONFFEED
- conf = F2IConfig::new(sio)
- assert_equal('http://something', conf.feeds[0].url)
- assert_equal('http://something2', conf.feeds[1].url)
- end
-
- def test_parts
- sio = StringIO::new CONFPARTS
- conf = F2IConfig::new(sio)
- assert conf.parts.include?('text')
- assert ! conf.parts.include?('html')
- end
-
- def test_url_array
- sio = StringIO::new CONFARRAYTARGET
- conf = F2IConfig::new(sio)
- assert_equal "/tmp/Maildir/feed1", conf.feeds.first.folder
- end
-
- def test_integer_as_name
- sio = StringIO.new CONFINTNAME
- conf = F2IConfig.new(sio)
- assert_equal "10", conf.feeds.first.name
- end
-
-end
diff --git a/test/tc_httpfetcher.rb b/test/tc_httpfetcher.rb
deleted file mode 100755
index e904086..0000000
--- a/test/tc_httpfetcher.rb
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/ruby
-
-$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
-
-require 'test/unit'
-require 'feed2imap/httpfetcher'
-
-class HttpFetcherTest < Test::Unit::TestCase
- def test_get_https
- s = ''
- assert_nothing_raised do
- s = fetcher.fetch('https://linuxfr.org/pub/', Time::at(0))
- end
- assert(s.length > 20)
- end
-
- def test_get_http
-
- end
-
- def test_get_httpnotmodif
- s = 'aaa'
- assert_nothing_raised do
- s = fetcher.fetch('http://www.lucas-nussbaum.net/feed2imap_tests/notmodified.php', Time::new())
- end
- assert_nil(s)
- end
-
- def test_get_redir1
- s = 'aaa'
- assert_nothing_raised do
- s = fetcher.fetch("http://www.lucas-nussbaum.net/feed2imap_tests/redir.php?redir=#{MAXREDIR}", Time::at(0))
- end
- assert_equal('OK', s)
- end
-
- def test_get_redir2
- s = ''
- assert_raise(RuntimeError) do
- s = fetcher.fetch("http://www.lucas-nussbaum.net/feed2imap_tests/redir.php?redir=#{MAXREDIR + 1}", Time::at(0))
- end
- end
-
- def test_httpauth
- s = ''
- assert_nothing_raised do
- s = fetcher.fetch("http://aaa:bbb@ensilinx1.imag.fr/~lucas/f2i_redirauth.php", Time::at(0))
- end
- assert_equal("Login: aaa / Password: bbb \n", s)
- end
-
- def test_redirauth
- s = ''
- assert_nothing_raised do
- s = fetcher.fetch("http://aaa:bbb@ensilinx1.imag.fr/~lucas/f2i_redirauth.php?redir=1", Time::at(0))
- end
- assert_equal("Login: aaa / Password: bbb \n", s)
- end
-
- def test_notfound
- s = ''
- assert_raises(RuntimeError) do
- s = fetcher.fetch("http://ensilinx1.imag.fr/~lucas/notfound.html", Time::at(0))
- end
- end
-
- private
-
- def fetcher
- HTTPFetcher.new
- end
-end
diff --git a/test/tc_maildir.rb b/test/tc_maildir.rb
deleted file mode 100644
index 7df47b8..0000000
--- a/test/tc_maildir.rb
+++ /dev/null
@@ -1,97 +0,0 @@
-require 'test/unit'
-require 'fileutils'
-require 'tmpdir'
-require 'mocha/setup'
-
-require 'feed2imap/maildir'
-
-class TestMaildir < Test::Unit::TestCase
-
- def setup
- @tmpdirs = []
- end
-
- def teardown
- @tmpdirs.each do |dir|
- FileUtils.rm_rf(dir)
- end
- end
-
- def test_cleanup
- folder = create_maildir
- msgs = message_count(folder)
-
- four_days_ago = Time.now - (4 * 24 * 60 * 60)
- old_message = Dir.glob(File.join(folder, '**/*:2,S')).first
- FileUtils.touch old_message, mtime: four_days_ago
-
- maildir_account.cleanup(folder)
-
- assert_equal msgs - 1, message_count(folder)
- end
-
- def test_putmail
- folder = create_maildir
- msgs = message_count(folder)
-
- mail = RMail::Message.new
- mail.header['Subject'] = 'a message I just created'
- mail.body = 'to test maildir'
- maildir_account.putmail(folder, mail)
-
- assert_equal msgs + 1, message_count(folder)
- end
-
- def test_updatemail
- folder = create_maildir
- path = maildir_account.send(
- :find_mails,
- folder,
- 'regular-message-id@debian.org'
- ).first
- assert_not_nil path
- mail = RMail::Message.new
- mail.header['Subject'] = 'a different subject'
- mail.header['Message-ID'] = 'regular-message-id@debian.org'
- mail.body = 'This is the body of the message'
- maildir_account.updatemail(folder, mail, 'regular-message-id@debian.org')
-
- updated_path = maildir_account.send(
- :find_mails,
- folder,
- 'regular-message-id@debian.org'
- ).first
- updated_mail = RMail::Parser.read(File.open(File.join(folder, updated_path)))
-
- assert_equal 'a different subject', updated_mail.header['Subject']
- end
-
- def test_find_mails
- folder = create_maildir
- assert_equal 0, maildir_account.send(:find_mails, folder, 'SomeRandomMessageID').size
- end
-
- private
-
- def create_maildir
- parent = Dir.mktmpdir
- @tmpdirs << parent
- FileUtils.cp_r('test/maildir', parent)
- return File.join(parent, 'maildir')
- end
-
- def message_count(folder)
- Dir.glob(File.join(folder, '**', '*')).reject { |f| File.directory?(f) }.size
- end
-
- def maildir_account
- @maildir_account ||=
- begin
- MaildirAccount.new.tap do |account|
- account.stubs(:puts)
- end
- end
- end
-
-end
-