2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2015-09-22 14:48:43 +00:00
|
|
|
require 'integration_test_helper'
|
|
|
|
|
|
|
|
class GeoIpCalendar < ActiveSupport::TestCase
|
|
|
|
|
|
|
|
# check
|
|
|
|
test 'check some results' do
|
|
|
|
|
2016-04-26 10:49:36 +00:00
|
|
|
result = Service::GeoCalendar.location('127.0.0.0.1')
|
2015-09-22 14:48:43 +00:00
|
|
|
assert(result)
|
|
|
|
assert_equal('My Calendar', result['name'])
|
|
|
|
assert_equal('America/Los_Angeles', result['timezone'])
|
2015-09-22 20:29:37 +00:00
|
|
|
assert_equal('', result['ical_url'])
|
2015-09-22 14:48:43 +00:00
|
|
|
|
2016-04-26 10:49:36 +00:00
|
|
|
result = Service::GeoCalendar.location('127.0.0.1')
|
2015-09-22 14:48:43 +00:00
|
|
|
assert(result)
|
|
|
|
assert_equal('My Calendar', result['name'])
|
|
|
|
assert_equal('America/Los_Angeles', result['timezone'])
|
2015-09-22 20:29:37 +00:00
|
|
|
assert_equal('', result['ical_url'])
|
2015-09-22 14:48:43 +00:00
|
|
|
|
2016-04-26 10:49:36 +00:00
|
|
|
result = Service::GeoCalendar.location('195.65.29.254')
|
2015-09-22 14:48:43 +00:00
|
|
|
assert(result)
|
|
|
|
assert_equal('Switzerland', result['name'])
|
|
|
|
assert_equal('Europe/Zurich', result['timezone'])
|
2021-09-15 17:39:52 +00:00
|
|
|
assert_equal('https://www.google.com/calendar/ical/de.ch%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
|
2015-09-22 14:48:43 +00:00
|
|
|
|
2016-04-26 10:49:36 +00:00
|
|
|
result = Service::GeoCalendar.location('195.191.132.18')
|
2015-09-22 14:48:43 +00:00
|
|
|
assert(result)
|
|
|
|
assert_equal('Switzerland', result['name'])
|
|
|
|
assert_equal('Europe/Zurich', result['timezone'])
|
2021-09-15 17:39:52 +00:00
|
|
|
assert_equal('https://www.google.com/calendar/ical/de.ch%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
|
2015-09-22 14:48:43 +00:00
|
|
|
|
2016-04-26 10:49:36 +00:00
|
|
|
result = Service::GeoCalendar.location('134.109.140.74')
|
2015-09-22 14:48:43 +00:00
|
|
|
assert(result)
|
|
|
|
assert_equal('Germany', result['name'])
|
|
|
|
assert_equal('Europe/Berlin', result['timezone'])
|
2021-09-15 17:39:52 +00:00
|
|
|
assert_equal('https://www.google.com/calendar/ical/de.german%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
|
2015-09-22 14:48:43 +00:00
|
|
|
|
2016-04-26 10:49:36 +00:00
|
|
|
result = Service::GeoCalendar.location('46.253.55.170')
|
2015-09-22 14:48:43 +00:00
|
|
|
assert(result)
|
|
|
|
assert_equal('Germany', result['name'])
|
|
|
|
assert_equal('Europe/Berlin', result['timezone'])
|
2021-09-15 17:39:52 +00:00
|
|
|
assert_equal('https://www.google.com/calendar/ical/de.german%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
|
2015-09-22 14:48:43 +00:00
|
|
|
|
2016-04-26 10:49:36 +00:00
|
|
|
result = Service::GeoCalendar.location('169.229.216.200')
|
2015-09-22 14:48:43 +00:00
|
|
|
assert(result)
|
|
|
|
assert_equal('United States/California', result['name'])
|
|
|
|
assert_equal('America/Los_Angeles', result['timezone'])
|
2021-09-15 17:39:52 +00:00
|
|
|
assert_equal('https://www.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
|
2015-09-22 14:48:43 +00:00
|
|
|
|
2016-04-26 10:49:36 +00:00
|
|
|
result = Service::GeoCalendar.location('17.171.2.25')
|
2015-09-22 14:48:43 +00:00
|
|
|
assert(result)
|
2020-05-06 06:49:59 +00:00
|
|
|
assert_equal('United States', result['name'])
|
|
|
|
assert_equal('America/Chicago', result['timezone'])
|
2021-09-15 17:39:52 +00:00
|
|
|
assert_equal('https://www.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
|
2015-09-22 14:48:43 +00:00
|
|
|
|
2016-04-26 10:49:36 +00:00
|
|
|
result = Service::GeoCalendar.location('184.168.47.225')
|
2015-09-22 14:48:43 +00:00
|
|
|
assert(result)
|
2020-05-06 06:49:59 +00:00
|
|
|
assert_equal('United States', result['name'])
|
|
|
|
assert_equal('America/Chicago', result['timezone'])
|
2021-09-15 17:39:52 +00:00
|
|
|
assert_equal('https://www.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
|
2015-09-22 14:48:43 +00:00
|
|
|
|
2016-04-26 10:49:36 +00:00
|
|
|
result = Service::GeoCalendar.location('69.172.201.245')
|
2015-09-22 14:48:43 +00:00
|
|
|
assert(result)
|
2020-05-06 06:49:59 +00:00
|
|
|
assert_equal('Canada', result['name'])
|
|
|
|
assert_equal('America/Toronto', result['timezone'])
|
2021-09-15 17:39:52 +00:00
|
|
|
assert_equal('https://www.google.com/calendar/ical/en.canadian%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
|
2015-09-22 14:48:43 +00:00
|
|
|
|
2016-04-26 10:49:36 +00:00
|
|
|
result = Service::GeoCalendar.location('132.247.70.37')
|
2015-09-22 14:48:43 +00:00
|
|
|
assert(result)
|
2020-05-06 06:49:59 +00:00
|
|
|
assert_equal('Mexico/Mexico City', result['name'])
|
|
|
|
assert_equal('America/Mexico_City', result['timezone'])
|
2021-09-15 17:39:52 +00:00
|
|
|
assert_equal('https://www.google.com/calendar/ical/en.mexican%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
|
2015-09-22 14:48:43 +00:00
|
|
|
|
|
|
|
end
|
|
|
|
end
|