blob: ce910e918410c55b53ffba6a049832876f4e6433 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#!/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
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
end
|