-
Notifications
You must be signed in to change notification settings - Fork 14.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: custom favorite filter for dashboards, charts and saved queries #11083
Merged
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
af0ecd1
feat: custom favorite filter for dashboards
dpgaspar 9f06eb2
Merge branch 'master' into feat/api-favorites
dpgaspar 59733d3
lint and sort
dpgaspar 0f75be8
add favored for charts
dpgaspar 30ef91c
fix tests and lint
dpgaspar 8eb19e9
more tests and saved query filter
dpgaspar aede712
fix tests
dpgaspar 91cd438
fix tests
dpgaspar 3b7c4d0
lint
dpgaspar 3355761
Merge branch 'master' into feat/api-favorites
dpgaspar 832266c
lint and fix conflict
dpgaspar f5a84e5
remove unnecessary prop
dpgaspar 2d38a86
separate tests
dpgaspar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ | |
from tests.base_tests import SupersetTestCase | ||
|
||
|
||
SAVED_QUERIES_FIXTURE_COUNT = 5 | ||
SAVED_QUERIES_FIXTURE_COUNT = 10 | ||
|
||
|
||
class TestSavedQueryApi(SupersetTestCase): | ||
|
@@ -326,17 +326,22 @@ def test_get_saved_query_favorite_filter(self): | |
self.login(username="admin") | ||
uri = f"api/v1/saved_query/?q={prison.dumps(arguments)}" | ||
rv = self.client.get(uri) | ||
self.assertEqual(rv.status_code, 200) | ||
data = json.loads(rv.data.decode("utf-8")) | ||
self.assertEqual(data["count"], len(expected_models)) | ||
assert rv.status_code == 200 | ||
assert len(expected_models) == data["count"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why did you change it to basic assert? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not written in stone but with pytest now, we are slowly refactoring to use assert |
||
|
||
for i, expected_model in enumerate(expected_models): | ||
assert expected_model.label == data["result"][i]["label"] | ||
|
||
# Test not favorite saves queries | ||
expected_models = ( | ||
db.session.query(SavedQuery) | ||
.filter(and_(~SavedQuery.id.in_(users_favorite_query))) | ||
.filter( | ||
and_( | ||
~SavedQuery.id.in_(users_favorite_query), | ||
SavedQuery.created_by == admin, | ||
) | ||
) | ||
.order_by(SavedQuery.label.asc()) | ||
.all() | ||
) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use self.assert200(rv)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it's used nowhere on the test codebase, not written in stone but with
pytest
now, we are slowly refactoring to useassert