betodealmeida commented on code in PR #20862:
URL: https://github.com/apache/superset/pull/20862#discussion_r932580741
##########
tests/integration_tests/datasets/api_tests.py:
##########
@@ -777,6 +777,35 @@ def test_update_dataset_item_w_override_columns(self):
db.session.delete(dataset)
db.session.commit()
+ def test_update_dataset_item_w_override_columns_same_columns(self):
+ """
+ Dataset API: Test update dataset with override columns
+ """
+ if backend() == "sqlite":
+ return
+
+ # Add default dataset
+ main_db = get_main_database()
+ dataset = self.insert_dataset("flights", [self.get_user("admin").id],
main_db)
+
+ self.login(username="admin")
+ dataset_data = {
+ "sql": "SELECT * from flights ",
+ "columns": [
+ {"column_name": "YEAR", "type": "INT", "is_dttm": False},
+ {"column_name": "MONTH", "type": "INT", "is_dttm": False},
+ {"column_name": "DAY", "type": "INT", "is_dttm": False},
+ ],
+ }
+ uri = f"api/v1/dataset/{dataset.id}?override_columns=true"
+ rv = self.put_assert_metric(uri, dataset_data, "put")
+ assert rv.status_code == 200
+
+ columns =
db.session.query(TableColumn).filter_by(table_id=dataset.id).all()
+ assert len(columns) == 3
Review Comment:
Can you add an assert that the number of columns was not 3 before the
update? (ie, in line ~790) Otherwise we don't know if the update actually did
anything.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]