fix: remove unnecessary exception when exploring non-legacy viz plugins (#10538)

* fix: remove unnecessary exception when exploring non-legacy viz plugins

* lint
This commit is contained in:
Ville Brofeldt
2020-08-07 08:41:39 +03:00
committed by GitHub
parent 0bad77f0fe
commit 363abfa1a5
4 changed files with 26 additions and 6 deletions

View File

@@ -22,6 +22,7 @@ from decimal import Decimal
import hashlib
import json
import os
import re
from unittest.mock import Mock, patch
import numpy
@@ -40,6 +41,7 @@ from superset.utils.core import (
convert_legacy_filters_into_adhoc,
create_ssl_cert_file,
format_timedelta,
get_form_data_token,
get_iterable,
get_email_address_list,
get_or_create_db,
@@ -1365,3 +1367,8 @@ class TestUtils(SupersetTestCase):
self.assertEqual("BaZ", validator("BaZ"))
self.assertRaises(marshmallow.ValidationError, validator, "qwerty")
self.assertRaises(marshmallow.ValidationError, validator, 4)
def test_get_form_data_token(self):
assert get_form_data_token({"token": "token_abcdefg1"}) == "token_abcdefg1"
generated_token = get_form_data_token({})
assert re.match(r"^token_[a-z0-9]{8}$", generated_token) is not None