blackbook 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data.tar.gz.sig +0 -0
- data/History.txt +5 -0
- data/Manifest.txt +1 -0
- data/lib/blackbook.rb +1 -1
- data/lib/blackbook/importer/gmail.rb +3 -2
- data/test/fixtures/gmail_login_response_stage_2a.html +1 -0
- data/test/test_blackbook_importer_gmail.rb +21 -0
- metadata +25 -3
- metadata.gz.sig +0 -0
data.tar.gz.sig
ADDED
Binary file
|
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
@@ -26,6 +26,7 @@ test/fixtures/gmail_bad_login_response_stage_2.html
|
|
26
26
|
test/fixtures/gmail_contacts.html
|
27
27
|
test/fixtures/gmail_login_response_stage_1.html
|
28
28
|
test/fixtures/gmail_login_response_stage_2.html
|
29
|
+
test/fixtures/gmail_login_response_stage_2a.html
|
29
30
|
test/fixtures/gmail_login_response_stage_3.html
|
30
31
|
test/fixtures/hotmail_bad_login_response_stage_2.html
|
31
32
|
test/fixtures/hotmail_contacts.html
|
data/lib/blackbook.rb
CHANGED
@@ -24,8 +24,9 @@ class Blackbook::Importer::Gmail < Blackbook::Importer::PageScraper
|
|
24
24
|
|
25
25
|
raise( Blackbook::BadCredentialsError, "That username and password was not accepted. Please check them and try again." ) if page.body =~ /Username and password do not match/
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
if page.search('//meta').first.attributes['content'] =~ /url='?(http.+?)'?$/i
|
28
|
+
page = agent.get $1
|
29
|
+
end
|
29
30
|
end
|
30
31
|
|
31
32
|
##
|
@@ -0,0 +1 @@
|
|
1
|
+
<html><head><meta http-equiv="Refresh" content="0;url='http://mail.google.com/mail/?ui=html&zy=l'" /></head><body></body></html>
|
@@ -65,6 +65,27 @@ class TestBlackbookImporterGmail < Test::Unit::TestCase
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
+
def test_login_alternative_uri
|
69
|
+
response = {'content-type' => 'text/html'}
|
70
|
+
|
71
|
+
body = load_fixture('gmail_login_response_stage_1.html').join
|
72
|
+
page = WWW::Mechanize::Page.new(uri=nil, response, body, code=nil, mech=nil)
|
73
|
+
@importer.agent.expects(:get).with('http://mail.google.com/').once.returns(page)
|
74
|
+
|
75
|
+
body = load_fixture('gmail_login_response_stage_2a.html').join
|
76
|
+
page = WWW::Mechanize::Page.new(uri=nil, response, body, code=nil, mech=nil)
|
77
|
+
@importer.agent.expects(:submit).once.returns(page)
|
78
|
+
|
79
|
+
body = load_fixture('gmail_login_response_stage_3.html').join
|
80
|
+
page = WWW::Mechanize::Page.new(uri=nil, response, body, code=nil, mech=nil)
|
81
|
+
@importer.agent.expects(:get).with('http://mail.google.com/mail/?ui=html&zy=l'
|
82
|
+
).once.returns(page)
|
83
|
+
|
84
|
+
assert_nothing_raised do
|
85
|
+
assert @importer.login
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
68
89
|
def test_scrape_contacts_raises_badcredentialerror_when_not_logged_in
|
69
90
|
@importer.agent.expects(:cookies).once.returns([])
|
70
91
|
assert_raises(Blackbook::BadCredentialsError) do
|
metadata
CHANGED
@@ -1,15 +1,36 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blackbook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Contentfree
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDPDCCAiSgAwIBAgIBADANBgkqhkiG9w0BAQUFADBEMRYwFAYDVQQDDA1taWtl
|
14
|
+
bW9uZHJhZ29uMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZ
|
15
|
+
FgNjb20wHhcNMDcwODI3MTk1NjQ1W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oNk4pWm9Ocmiww==
|
31
|
+
-----END CERTIFICATE-----
|
11
32
|
|
12
|
-
date: 2008-02-
|
33
|
+
date: 2008-02-08 00:00:00 -08:00
|
13
34
|
default_executable:
|
14
35
|
dependencies:
|
15
36
|
- !ruby/object:Gem::Dependency
|
@@ -78,6 +99,7 @@ files:
|
|
78
99
|
- test/fixtures/gmail_contacts.html
|
79
100
|
- test/fixtures/gmail_login_response_stage_1.html
|
80
101
|
- test/fixtures/gmail_login_response_stage_2.html
|
102
|
+
- test/fixtures/gmail_login_response_stage_2a.html
|
81
103
|
- test/fixtures/gmail_login_response_stage_3.html
|
82
104
|
- test/fixtures/hotmail_bad_login_response_stage_2.html
|
83
105
|
- test/fixtures/hotmail_contacts.html
|
metadata.gz.sig
ADDED
Binary file
|