geo_calendar_test.rb 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. require 'integration_test_helper'
  2. class GeoIpCalendar < ActiveSupport::TestCase
  3. # check
  4. test 'check some results' do
  5. result = Service::GeoCalendar.location('127.0.0.0.1')
  6. assert(result)
  7. assert_equal('My Calendar', result['name'])
  8. assert_equal('America/Los_Angeles', result['timezone'])
  9. assert_equal('', result['ical_url'])
  10. result = Service::GeoCalendar.location('127.0.0.1')
  11. assert(result)
  12. assert_equal('My Calendar', result['name'])
  13. assert_equal('America/Los_Angeles', result['timezone'])
  14. assert_equal('', result['ical_url'])
  15. result = Service::GeoCalendar.location('195.65.29.254')
  16. assert(result)
  17. assert_equal('Switzerland', result['name'])
  18. assert_equal('Europe/Zurich', result['timezone'])
  19. assert_equal('http://www.google.com/calendar/ical/de.ch%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
  20. result = Service::GeoCalendar.location('195.191.132.18')
  21. assert(result)
  22. assert_equal('Switzerland', result['name'])
  23. assert_equal('Europe/Zurich', result['timezone'])
  24. assert_equal('http://www.google.com/calendar/ical/de.ch%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
  25. result = Service::GeoCalendar.location('134.109.140.74')
  26. assert(result)
  27. assert_equal('Germany', result['name'])
  28. assert_equal('Europe/Berlin', result['timezone'])
  29. assert_equal('http://www.google.com/calendar/ical/de.german%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
  30. result = Service::GeoCalendar.location('46.253.55.170')
  31. assert(result)
  32. assert_equal('Germany', result['name'])
  33. assert_equal('Europe/Berlin', result['timezone'])
  34. assert_equal('http://www.google.com/calendar/ical/de.german%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
  35. result = Service::GeoCalendar.location('169.229.216.200')
  36. assert(result)
  37. assert_equal('United States/California', result['name'])
  38. assert_equal('America/Los_Angeles', result['timezone'])
  39. assert_equal('http://www.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
  40. result = Service::GeoCalendar.location('17.171.2.25')
  41. assert(result)
  42. assert_equal('United States/California', result['name'])
  43. assert_equal('America/Los_Angeles', result['timezone'])
  44. assert_equal('http://www.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
  45. result = Service::GeoCalendar.location('184.168.47.225')
  46. assert(result)
  47. assert_equal('United States/Arizona', result['name'])
  48. assert_equal('America/Phoenix', result['timezone'])
  49. assert_equal('http://www.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
  50. result = Service::GeoCalendar.location('69.172.201.245')
  51. assert(result)
  52. assert_equal('United States/New York', result['name'])
  53. assert_equal('America/New_York', result['timezone'])
  54. assert_equal('http://www.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
  55. result = Service::GeoCalendar.location('132.247.70.37')
  56. assert(result)
  57. assert_equal('Mexico/Sonora', result['name'])
  58. assert_equal('America/Hermosillo', result['timezone'])
  59. assert_equal('http://www.google.com/calendar/ical/en.mexican%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
  60. end
  61. end