ref: master
vendor/contacts/test/unit/hotmail_contact_importer_test.rb
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 |
dir = File.dirname(__FILE__) require "#{dir}/../test_helper" require 'contacts' class HotmailContactImporterTest < ContactImporterTestCase def setup super @account = TestAccounts[:hotmail] end def test_successful_login Contacts.new(:hotmail, @account.username, @account.password) end def test_importer_fails_with_invalid_password assert_raise(Contacts::AuthenticationError) do Contacts.new(:hotmail, @account.username,"wrong_password") end end def test_fetch_contacts contacts = Contacts.new(:hotmail, @account.username, @account.password).contacts @account.contacts.each do |contact| assert contacts.include?(contact), "Could not find: #{contact.inspect} in #{contacts.inspect}" end end def test_importer_fails_with_invalid_msn_password assert_raise(Contacts::AuthenticationError) do Contacts.new(:hotmail, "test@msn.com","wrong_password") end end # Since the hotmail scraper doesn't read names, test email def test_fetch_email contacts = Contacts.new(:hotmail, @account.username, @account.password).contacts @account.contacts.each do |contact| assert contacts.any?{|book_contact| book_contact.last == contact.last }, "Could not find: #{contact.inspect} in #{contacts.inspect}" end end end |