Exemple #1
0
class ZoomUpdateTest(TestCase):
    def test_zoom_update(self):
        self.layer = LayerFactory()
        with self.assertRaises(KeyError):
            self.layer.layer_settings('tiles', 'maxzoom')

        # Call the decorator manualy on nop lambda
        self.layer.beta_lambda = lambda *args, **kargs: False
        zoom_update(self.layer.beta_lambda)(self.layer)

        self.assertEqual(
            self.layer.layer_settings('tiles', 'maxzoom') is not None, True)
Exemple #2
0
class LayerSettingsTestCase(TestCase):
    def setUp(self):
        self.client = APIClient()
        self.layer = LayerFactory()
        self.user = UserFactory()
        self.client.force_authenticate(self.user)

    def test_layer_settings(self):
        with self.assertRaises(KeyError):
            self.layer.layer_settings('foo', 'bar', '666')

        with self.assertRaises(KeyError):
            self.layer.layer_settings('tiles', 'minzoom')

        self.assertEqual(
            self.layer.layer_settings_with_default('tiles', 'minzoom'), 0)

    def test_set_layer_settings(self):
        with self.assertRaises(KeyError):
            self.layer.layer_settings('foo', 'bar')

        self.layer.set_layer_settings('foo', 'bar', 123)

        self.assertEqual(self.layer.layer_settings('foo', 'bar'), 123)

        self.assertEqual(self.layer.layer_settings_with_default('foo', 'bar'),
                         123)