hughhhh commented on a change in pull request #11332:
URL:
https://github.com/apache/incubator-superset/pull/11332#discussion_r508927244
##########
File path: tests/datasets/api_tests.py
##########
@@ -1006,6 +1008,68 @@ def test_export_dataset_gamma(self):
rv = self.client.get(uri)
self.assertEqual(rv.status_code, 401)
+ @patch.dict(
+ "superset.extensions.feature_flag_manager._feature_flags",
+ {"VERSIONED_EXPORT": True},
+ clear=True,
+ )
+ def test_export_dataset_bundle(self):
+ """
+ Dataset API: Test export dataset
+ """
+ birth_names_dataset = self.get_birth_names_dataset()
+ # TODO: fix test for presto
+ # debug with dump:
https://github.com/apache/incubator-superset/runs/1092546855
+ if birth_names_dataset.database.backend in {"presto", "hive"}:
+ return
+
+ argument = [birth_names_dataset.id]
+ uri = f"api/v1/dataset/export/?q={prison.dumps(argument)}"
+
+ self.login(username="admin")
+ rv = self.get_assert_metric(uri, "export")
+
+ assert rv.status_code == 200
+
+ buf = BytesIO(rv.data)
+ assert is_zipfile(buf)
+
+ @patch.dict(
+ "superset.extensions.feature_flag_manager._feature_flags",
+ {"VERSIONED_EXPORT": True},
+ clear=True,
+ )
+ def test_export_dataset_bundle_not_found(self):
+ """
+ Dataset API: Test export dataset not found
+ """
+ # Just one does not exist and we get 404
+ argument = [-1, 1]
+ uri = f"api/v1/dataset/export/?q={prison.dumps(argument)}"
+ self.login(username="admin")
+ rv = self.get_assert_metric(uri, "export")
+
+ assert rv.status_code == 404
Review comment:
```suggestion
self.assertEqual(rv.status_code, 404)
```
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]