willbarrett commented on a change in pull request #9054: [database] new, select
star API migration
URL:
https://github.com/apache/incubator-superset/pull/9054#discussion_r373080970
##########
File path: tests/database_api_tests.py
##########
@@ -140,3 +140,34 @@ def test_get_table_metadata_no_db_permission(self):
uri = f"api/v1/database/{example_db.id}/birth_names/null/"
rv = self.client.get(uri)
self.assertEqual(rv.status_code, 404)
+
+ def test_get_select_star(self):
+ """
+ Database API: Test get select star
+ """
+ self.login(username="admin")
+ example_db = get_example_database()
+ uri = f"api/v1/database/{example_db.id}/select_star/birth_names/"
+ rv = self.client.get(uri)
+ self.assertEqual(rv.status_code, 200)
+ response = json.loads(rv.data.decode("utf-8"))
+ self.assertIn("gender", response["result"])
+
+ def test_get_select_star_not_allowed(self):
+ """
+ Database API: Test get select star not allowed
+ """
+ self.login(username="gamma")
+ example_db = get_example_database()
+ uri = f"api/v1/database/{example_db.id}/select_star/birth_names/"
+ rv = self.client.get(uri)
+ self.assertEqual(rv.status_code, 404)
+
+ def test_get_select_star_not_found(self):
+ """
+ Database API: Test get select star not found
+ """
+ self.login(username="admin")
+ uri = f"api/v1/database/1000/select_star/birth_names/"
Review comment:
To avoid possible flakiness, I'd recommend getting the last primary key for
databases and adding 1 - a fixed primary key can result in failures when the
primary keys of created resources drift upwards over time..
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]