You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2022/09/01 20:28:21 UTC
[superset] branch ds-404-test updated: add test for not found from datasource dao
This is an automated email from the ASF dual-hosted git repository.
hugh pushed a commit to branch ds-404-test
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/ds-404-test by this push:
new fd3de01e32 add test for not found from datasource dao
fd3de01e32 is described below
commit fd3de01e3251d2036804e2c0e0689711a217f77c
Author: hughhhh <hu...@gmail.com>
AuthorDate: Thu Sep 1 13:28:03 2022 -0700
add test for not found from datasource dao
---
tests/unit_tests/datasource/dao_tests.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tests/unit_tests/datasource/dao_tests.py b/tests/unit_tests/datasource/dao_tests.py
index 8647f97f74..cb313b3dd7 100644
--- a/tests/unit_tests/datasource/dao_tests.py
+++ b/tests/unit_tests/datasource/dao_tests.py
@@ -202,3 +202,15 @@ def test_get_all_datasources(session_with_data: Session) -> None:
result = SqlaTable.get_all_datasources(session=session_with_data)
assert len(result) == 1
+
+
+def test_not_found_datasource(session_with_data: Session) -> None:
+ from superset.dao.exceptions import DatasourceNotFound
+ from superset.datasource.dao import DatasourceDAO
+
+ with pytest.raises(DatasourceNotFound):
+ DatasourceDAO.get_datasource(
+ datasource_type="table",
+ datasource_id=500000,
+ session=session_with_data,
+ )