Skip to content
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

fix(test): missing auth on tests #10842

Merged
merged 3 commits into from
Sep 11, 2020
Merged

Conversation

dpgaspar
Copy link
Member

@dpgaspar dpgaspar commented Sep 11, 2020

SUMMARY

Fixes some tests that were successful but were actually testing on a non authenticated user context (they were supposed to run with admin). This surfaced while cherry picking for 0.38.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

@pull-request-size pull-request-size bot added size/M and removed size/S labels Sep 11, 2020
@dpgaspar dpgaspar marked this pull request as ready for review September 11, 2020 11:55
result = json.loads(self.get_resp("/superset/results/key/"))
expected = {"status": "success", "query": {"rows": 100}, "data": data}
self.assertEqual(result, expected)
with mock.patch("superset.views.core.db") as mock_superset_db:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using the mock has a decorator was mocking for self.login() also

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch 👍 LGTM, but I wonder if we should standardize on how self.login is called. It appears the test codebase is mostly calling self.login("admin"), which is the exact same as self.login() due to defaults. I wonder if we should just make it mandatory to specify the username?

@dpgaspar
Copy link
Member Author

Nice catch 👍 LGTM, but I wonder if we should standardize on how self.login is called. It appears the test codebase is mostly calling self.login("admin"), which is the exact same as self.login() due to defaults. I wonder if we should just make it mandatory to specify the username?

Yes, agree we should standardize, I'm planning on making of bunch of PR's to refactor tests to use pytest fixtures also, it may make sense to include that on those.

@dpgaspar dpgaspar merged commit 7b22004 into apache:master Sep 11, 2020
@dpgaspar dpgaspar deleted the fix/tests-auth branch September 11, 2020 13:28
auxten pushed a commit to auxten/incubator-superset that referenced this pull request Nov 20, 2020
* fix(test): missing auth on tests

* fix mock

* make test login more inline with other tests
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.38.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/M 🚢 0.38.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants