from AccessControl import Unauthorized
from zope.app.tests import ztapi
from zope.app.annotation import IAttributeAnnotatable
from zope.interface import directlyProvides
from zope.interface.verify import verifyClass
from Testing.ZopeTestCase.PortalTestCase import user_name, user_password
from Products.CMFCore.utils import getToolByName
from geo.interfaces import IPoint
from Products.geolocation.adapters.geolocation import Point
from Products.qPloneGoogleMaps.adapters.markers import MarkersListing
from Products.qPloneGoogleMaps.browser.markersview import MarkersView
from Products.qPloneGoogleMaps.interfaces.markers import IMarkersListing, IMarkersView
from Products.qPloneGoogleMaps import validator
from Products.qPloneGoogleMaps.utility import processDesc
from Products.qPloneGoogleMaps.content import Map, Overlay, Marker
import MapFieldTest
from Products.PloneTestCase import PloneTestCase
PRODUCTS=('geolocation', 'qPloneGoogleMaps')
map(PloneTestCase.installProduct, PRODUCTS)
PloneTestCase.setupPloneSite(products=PRODUCTS)
PRODUCT = 'qPloneGoogleMaps'
def maps_login(self, role):
""" Utility method for login under required role """
from Testing.ZopeTestCase.PortalTestCase import user_name, user_password
if role == 'manager':
self.loginAsPortalOwner()
elif role == 'member':
self.login(user_name)
elif role == 'another_member':
self.login('another_member')
elif role == 'anonym':
self.logout()
# Installation testing stuff
NEW_PORTAL_TYPES = ['Map', 'Marker', 'Overlay']
MAP_API_KEYS = ("http://localhost.com:8888/map|ABQIAAAAPKXXAksH6LF9wD3-iB3Z9hR-_Derz1M-sZYUdeXG3J1uZOMrKxT98efydo7fhYu6kuaFv5ESjlw4mw", )
TOPIC_VIEW = 'topic_maps_view'
MAP_PORTLETS = ['here/portlet_maps/macros/portlet', 'here/portlet_overlays/macros/portlet',]
PROPERTY_SHEET = 'maps_properties'
PROPERTY_FIELD = 'map_api_keys'
GEO_INDEX = 'geoLocation'
# Utils testing stuff
UNPROCESSED_STRING = """This is "unprocessed" string
with carriage return and double
quotes."""
PROCESSED_STRING = "This is 'unprocessed' string with carriage return and double quotes."
# Validation testing stuff
# Field and widget testing stuff
FIELD_VALUE = (3.5, 20.4)
# Functional testing stuff
NEW_MAP_KEY = "http://nohost/plone|IAAAAPKXXAksH6LF9wD3-iB3Z9hR-_Derz1M-sZYUdeXG3J1uZOMrKxT98efydo7fhYu6kuaFv5ES"
# Map testing stuff
MAP_VIEW_JAVASCRIPT = """
"""
# Overlay testing stuff
OVERLAY_COLOR = 'blue'
OVERLAY_VIEW_JAVASCRIPT = """
"""
# Marker testing stuff
MARKER_VIEW_JAVASCRIPT = """
"""