This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch main_db_not_needed
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git

commit dc3dea11640f36396104b12d9b67dc7551ba71d7
Author: Maxime Beauchemin <[email protected]>
AuthorDate: Thu Aug 29 21:26:31 2019 -0700

    Kill get_main_database
---
 tests/core_tests.py               | 18 +++++++++---------
 tests/dict_import_export_tests.py |  4 ++--
 tests/model_tests.py              |  6 +++---
 tests/sqla_models_tests.py        |  6 +++---
 4 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/tests/core_tests.py b/tests/core_tests.py
index 9b641a9..51d883b 100644
--- a/tests/core_tests.py
+++ b/tests/core_tests.py
@@ -346,7 +346,7 @@ class CoreTests(SupersetTestCase):
 
     def test_testconn(self, username="admin"):
         self.login(username=username)
-        database = utils.get_main_database()
+        database = utils.get_example_database()
 
         # validate that the endpoint works with the password-masked sqlalchemy 
uri
         data = json.dumps(
@@ -377,7 +377,7 @@ class CoreTests(SupersetTestCase):
         assert response.headers["Content-Type"] == "application/json"
 
     def test_custom_password_store(self):
-        database = utils.get_main_database()
+        database = utils.get_example_database()
         conn_pre = sqla.engine.url.make_url(database.sqlalchemy_uri_decrypted)
 
         def custom_password_store(uri):
@@ -395,13 +395,13 @@ class CoreTests(SupersetTestCase):
         # validate that sending a password-masked uri does not over-write the 
decrypted
         # uri
         self.login(username=username)
-        database = utils.get_main_database()
+        database = utils.get_example_database()
         sqlalchemy_uri_decrypted = database.sqlalchemy_uri_decrypted
         url = "databaseview/edit/{}".format(database.id)
         data = {k: database.__getattribute__(k) for k in 
DatabaseView.add_columns}
         data["sqlalchemy_uri"] = database.safe_sqlalchemy_uri()
         self.client.post(url, data=data)
-        database = utils.get_main_database()
+        database = utils.get_example_database()
         self.assertEqual(sqlalchemy_uri_decrypted, 
database.sqlalchemy_uri_decrypted)
 
     def test_warm_up_cache(self):
@@ -484,27 +484,27 @@ class CoreTests(SupersetTestCase):
 
     def test_extra_table_metadata(self):
         self.login("admin")
-        dbid = utils.get_main_database().id
+        dbid = utils.get_example_database().id
         self.get_json_resp(
             f"/superset/extra_table_metadata/{dbid}/" 
"ab_permission_view/panoramix/"
         )
 
     def test_process_template(self):
-        maindb = utils.get_main_database()
+        maindb = utils.get_example_database()
         sql = "SELECT '{{ datetime(2017, 1, 1).isoformat() }}'"
         tp = jinja_context.get_template_processor(database=maindb)
         rendered = tp.process_template(sql)
         self.assertEqual("SELECT '2017-01-01T00:00:00'", rendered)
 
     def test_get_template_kwarg(self):
-        maindb = utils.get_main_database()
+        maindb = utils.get_example_database()
         s = "{{ foo }}"
         tp = jinja_context.get_template_processor(database=maindb, foo="bar")
         rendered = tp.process_template(s)
         self.assertEqual("bar", rendered)
 
     def test_template_kwarg(self):
-        maindb = utils.get_main_database()
+        maindb = utils.get_example_database()
         s = "{{ foo }}"
         tp = jinja_context.get_template_processor(database=maindb)
         rendered = tp.process_template(s, foo="bar")
@@ -517,7 +517,7 @@ class CoreTests(SupersetTestCase):
         self.assertEqual(data["data"][0]["test"], "2017-01-01T00:00:00")
 
     def test_table_metadata(self):
-        maindb = utils.get_main_database()
+        maindb = utils.get_example_database()
         backend = maindb.backend
         data = 
self.get_json_resp("/superset/table/{}/ab_user/null/".format(maindb.id))
         self.assertEqual(data["name"], "ab_user")
diff --git a/tests/dict_import_export_tests.py 
b/tests/dict_import_export_tests.py
index fafa024..26080def 100644
--- a/tests/dict_import_export_tests.py
+++ b/tests/dict_import_export_tests.py
@@ -23,7 +23,7 @@ import yaml
 from superset import db
 from superset.connectors.druid.models import DruidColumn, DruidDatasource, 
DruidMetric
 from superset.connectors.sqla.models import SqlaTable, SqlMetric, TableColumn
-from superset.utils.core import get_main_database
+from superset.utils.core import get_example_database
 from .base_tests import SupersetTestCase
 
 DBREF = "dict_import__export_test"
@@ -63,7 +63,7 @@ class DictImportExportTests(SupersetTestCase):
         params = {DBREF: id, "database_name": database_name}
 
         dict_rep = {
-            "database_id": get_main_database().id,
+            "database_id": get_example_database().id,
             "table_name": name,
             "schema": schema,
             "id": id,
diff --git a/tests/model_tests.py b/tests/model_tests.py
index 55926cf..918f6d7 100644
--- a/tests/model_tests.py
+++ b/tests/model_tests.py
@@ -22,7 +22,7 @@ from sqlalchemy.engine.url import make_url
 
 from superset import app
 from superset.models.core import Database
-from superset.utils.core import get_example_database, get_main_database, 
QueryStatus
+from superset.utils.core import get_example_database, QueryStatus
 from .base_tests import SupersetTestCase
 
 
@@ -127,7 +127,7 @@ class DatabaseModelTestCase(SupersetTestCase):
         assert sql.startswith(expected)
 
     def test_single_statement(self):
-        main_db = get_main_database()
+        main_db = get_example_database()
 
         if main_db.backend == "mysql":
             df = main_db.get_df("SELECT 1", None)
@@ -137,7 +137,7 @@ class DatabaseModelTestCase(SupersetTestCase):
             self.assertEquals(df.iat[0, 0], 1)
 
     def test_multi_statement(self):
-        main_db = get_main_database()
+        main_db = get_example_database()
 
         if main_db.backend == "mysql":
             df = main_db.get_df("USE superset; SELECT 1", None)
diff --git a/tests/sqla_models_tests.py b/tests/sqla_models_tests.py
index a46f388..326311a 100644
--- a/tests/sqla_models_tests.py
+++ b/tests/sqla_models_tests.py
@@ -16,7 +16,7 @@
 # under the License.
 from superset.connectors.sqla.models import SqlaTable, TableColumn
 from superset.db_engine_specs.druid import DruidEngineSpec
-from superset.utils.core import get_main_database
+from superset.utils.core import get_example_database
 from .base_tests import SupersetTestCase
 
 
@@ -43,7 +43,7 @@ class DatabaseModelTestCase(SupersetTestCase):
 
     def test_has_extra_cache_keys(self):
         query = "SELECT '{{ cache_key_wrapper('user_1') }}' as user"
-        table = SqlaTable(sql=query, database=get_main_database())
+        table = SqlaTable(sql=query, database=get_example_database())
         query_obj = {
             "granularity": None,
             "from_dttm": None,
@@ -60,7 +60,7 @@ class DatabaseModelTestCase(SupersetTestCase):
 
     def test_has_no_extra_cache_keys(self):
         query = "SELECT 'abc' as user"
-        table = SqlaTable(sql=query, database=get_main_database())
+        table = SqlaTable(sql=query, database=get_example_database())
         query_obj = {
             "granularity": None,
             "from_dttm": None,

Reply via email to