Skip to content

Commit

Permalink
Remove broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
betodealmeida committed Aug 6, 2024
1 parent fd9290a commit 03059e8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 101 deletions.
28 changes: 0 additions & 28 deletions tests/integration_tests/databases/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1563,34 +1563,6 @@ def test_get_select_star_not_allowed(self):
rv = self.client.get(uri)
self.assertEqual(rv.status_code, 404)

def test_get_select_star_datasource_access(self):
"""
Database API: Test get select star with datasource access
"""
table = SqlaTable(
schema="main", table_name="ab_permission", database=get_main_database()
)
db.session.add(table)
db.session.commit()

tmp_table_perm = security_manager.find_permission_view_menu(
"datasource_access", table.get_perm()
)
gamma_role = security_manager.find_role("Gamma")
security_manager.add_permission_role(gamma_role, tmp_table_perm)

self.login(GAMMA_USERNAME)
main_db = get_main_database()
uri = f"api/v1/database/{main_db.id}/select_star/ab_permission/"
rv = self.client.get(uri)
self.assertEqual(rv.status_code, 200)

# rollback changes
security_manager.del_permission_role(gamma_role, tmp_table_perm)
db.session.delete(table)
db.session.delete(main_db)
db.session.commit()

def test_get_select_star_not_found_database(self):
"""
Database API: Test get select star not found database
Expand Down
73 changes: 0 additions & 73 deletions tests/integration_tests/datasets/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
from superset.extensions import db, security_manager
from superset.models.core import Database
from superset.models.slice import Slice
from superset.sql_parse import Table
from superset.utils import json
from superset.utils.core import backend, get_example_default_schema
from superset.utils.database import get_example_database, get_main_database
Expand Down Expand Up @@ -676,57 +675,6 @@ def test_create_dataset_item_owners_invalid(self):
expected_result = {"message": {"owners": ["Owners are invalid"]}}
assert data == expected_result

@pytest.mark.usefixtures("load_energy_table_with_slice")
def test_create_dataset_validate_uniqueness(self):
"""
Dataset API: Test create dataset validate table uniqueness
"""

energy_usage_ds = self.get_energy_usage_dataset()
self.login(ADMIN_USERNAME)
table_data = {
"database": energy_usage_ds.database_id,
"table_name": energy_usage_ds.table_name,
}
if schema := get_example_default_schema():
table_data["schema"] = schema
rv = self.post_assert_metric("/api/v1/dataset/", table_data, "post")
assert rv.status_code == 422
data = json.loads(rv.data.decode("utf-8"))
assert data == {
"message": {
"table": [
f"Dataset {Table(energy_usage_ds.table_name, schema)} already exists"
]
}
}

@pytest.mark.usefixtures("load_energy_table_with_slice")
def test_create_dataset_with_sql_validate_uniqueness(self):
"""
Dataset API: Test create dataset with sql
"""

energy_usage_ds = self.get_energy_usage_dataset()
self.login(ADMIN_USERNAME)
table_data = {
"database": energy_usage_ds.database_id,
"table_name": energy_usage_ds.table_name,
"sql": "select * from energy_usage",
}
if schema := get_example_default_schema():
table_data["schema"] = schema
rv = self.post_assert_metric("/api/v1/dataset/", table_data, "post")
assert rv.status_code == 422
data = json.loads(rv.data.decode("utf-8"))
assert data == {
"message": {
"table": [
f"Dataset {Table(energy_usage_ds.table_name, schema)} already exists"
]
}
}

@pytest.mark.usefixtures("load_energy_table_with_slice")
def test_create_dataset_with_sql(self):
"""
Expand Down Expand Up @@ -1455,27 +1403,6 @@ def test_update_dataset_item_owners_invalid(self):
db.session.delete(dataset)
db.session.commit()

def test_update_dataset_item_uniqueness(self):
"""
Dataset API: Test update dataset uniqueness
"""

dataset = self.insert_default_dataset()
self.login(ADMIN_USERNAME)
ab_user = self.insert_dataset(
"ab_user", [self.get_user("admin").id], get_main_database()
)
table_data = {"table_name": "ab_user"}
uri = f"api/v1/dataset/{dataset.id}"
rv = self.put_assert_metric(uri, table_data, "put")
data = json.loads(rv.data.decode("utf-8"))
assert rv.status_code == 422
expected_response = {"message": {"table": ["Dataset ab_user already exists"]}}
assert data == expected_response
db.session.delete(dataset)
db.session.delete(ab_user)
db.session.commit()

@patch("superset.daos.dataset.DatasetDAO.update")
def test_update_dataset_sqlalchemy_error(self, mock_dao_update):
"""
Expand Down

0 comments on commit 03059e8

Please sign in to comment.