mirror of
https://github.com/apache/superset.git
synced 2026-04-17 23:25:05 +00:00
fix: catch error when masking encrypted extra is none (#21570)
This commit is contained in:
committed by
GitHub
parent
c1ba3290d9
commit
ef78ec6b30
@@ -228,9 +228,52 @@ def test_unmask_encrypted_extra() -> None:
|
||||
}
|
||||
)
|
||||
|
||||
assert json.loads(GSheetsEngineSpec.unmask_encrypted_extra(old, new)) == {
|
||||
assert json.loads(str(GSheetsEngineSpec.unmask_encrypted_extra(old, new))) == {
|
||||
"service_account_info": {
|
||||
"project_id": "yellow-unicorn-314419",
|
||||
"private_key": "SECRET",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def test_unmask_encrypted_extra_when_old_is_none() -> None:
|
||||
"""
|
||||
Test that a None value works for ``encrypted_extra``.
|
||||
"""
|
||||
from superset.db_engine_specs.gsheets import GSheetsEngineSpec
|
||||
|
||||
old = None
|
||||
new = json.dumps(
|
||||
{
|
||||
"service_account_info": {
|
||||
"project_id": "yellow-unicorn-314419",
|
||||
"private_key": "XXXXXXXXXX",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
assert json.loads(str(GSheetsEngineSpec.unmask_encrypted_extra(old, new))) == {
|
||||
"service_account_info": {
|
||||
"project_id": "yellow-unicorn-314419",
|
||||
"private_key": "XXXXXXXXXX",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def test_unmask_encrypted_extra_when_new_is_none() -> None:
|
||||
"""
|
||||
Test that a None value works for ``encrypted_extra``.
|
||||
"""
|
||||
from superset.db_engine_specs.gsheets import GSheetsEngineSpec
|
||||
|
||||
old = json.dumps(
|
||||
{
|
||||
"service_account_info": {
|
||||
"project_id": "yellow-unicorn-314419",
|
||||
"private_key": "XXXXXXXXXX",
|
||||
},
|
||||
}
|
||||
)
|
||||
new = None
|
||||
|
||||
assert GSheetsEngineSpec.unmask_encrypted_extra(old, new) is None
|
||||
|
||||
Reference in New Issue
Block a user