def test_kuviz_publisher_use_custom_api_key(self, mocker): setup_mocks(mocker, self.credentials) vmap = Map(Layer('fake_table', credentials=self.credentials)) kuviz_publisher = KuvizPublisher(None) kuviz_publisher.set_layers(vmap.layers, 'fake_api_key') layers = kuviz_publisher.get_layers() assert layers[0].source.credentials == self.credentials assert layers[0].credentials == ({ 'username': self.username, 'api_key': 'fake_api_key', 'base_url': 'https://{}.carto.com'.format(self.username) })
def test_kuviz_publisher_use_only_base_url(self, mocker): credentials = Credentials(base_url='https://fakeuser.carto.com') setup_mocks(mocker, credentials) vmap = Map(Layer('fake_table', credentials=credentials)) kuviz_publisher = KuvizPublisher(None) kuviz_publisher.set_layers(vmap.layers) layers = kuviz_publisher.get_layers() assert layers[0].source.credentials == credentials assert layers[0].credentials == ({ 'username': '******', # Default VL username 'api_key': DEFAULT_PUBLIC, 'base_url': 'https://fakeuser.carto.com' })