Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_map_publish_update_name(self):
dataset = DatasetMock('fake_table', credentials=self.credentials)
map = MapMock(Layer(Source(dataset)))
name = 'cf_publish'
map.publish(name, credentials=self.credentials)
new_name = 'cf_update'
kuviz_dict = map.update_publication(new_name, password=None)
self.assert_kuviz_dict(kuviz_dict, new_name, PRIVACY_PUBLIC)
self.assert_kuviz(map._kuviz, new_name, PRIVACY_PUBLIC)
def setUp(self):
self.orig_compute_query_bounds = Source._compute_query_bounds
Source._compute_query_bounds = Mock(return_valye=None)
def setUp(self):
self.orig_compute_query_bounds = Source._compute_query_bounds
Source._compute_query_bounds = Mock(return_valye=None)
def test_default_interactive_layer(self):
"""Map layer should get the default event if the interactivity is set to []"""
source_1 = Source(build_geojson([-10, 0], [-10, 0]))
layer = Layer(
source_1,
popup={}
)
map = Map(layer)
self.assertEqual(map.layer_defs[0].get('interactivity'), [])
def tearDown(self):
Source._compute_query_bounds = self.orig_compute_query_bounds
def test_global_camera(self):
"""Layout should return the correct camera for each map"""
layout = Layout([
Map(Layer(Source(SOURCE))),
Map(Layer(Source(SOURCE)))
], viewport={'zoom': 5})
assert layout._layout[0].get('camera') == {
'bearing': None, 'center': None, 'pitch': None, 'zoom': 5}
assert layout._layout[1].get('camera') == {
'bearing': None, 'center': None, 'pitch': None, 'zoom': 5}
def test_kuviz_publisher_create_remote_sync(self):
dataset = DatasetMock('fake_table', credentials=self.credentials)
vmap = Map(Layer(Source(dataset)))
kp = KuvizPublisherMock(vmap.layers)
self.assertEqual(kp.is_sync(), True)
def test_initialization_objects(self, mocker):
"""Layer should initialize layer attributes"""
setup_mocks(mocker, 'layer_source')
layer = Layer(Source('layer_source', credentials=Credentials('fakeuser')))
assert layer.is_basemap is False
assert layer.source_data == 'SELECT * FROM "public"."layer_source"'
assert isinstance(layer.source, Source)
assert isinstance(layer.style, Style)
assert isinstance(layer.popup, Popup)
assert isinstance(layer.legend, Legend)
assert layer.interactivity == []