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

refactor(test): add login_as_admin to global conftest #20703

Merged
merged 1 commit into from
Jul 15, 2022

Conversation

ktmud
Copy link
Member

@ktmud ktmud commented Jul 13, 2022

SUMMARY

test_client and login_as seems to be two very commonly used utilities for integration tests. Let's move it to global conftest.

Only did this for function-based test suites. Class based test suites should probably be refactor to function-based later.

No visible changes to users.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TESTING INSTRUCTIONS

  • Unit test should still all passes

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@ktmud ktmud marked this pull request as ready for review July 13, 2022 20:35
@ktmud ktmud changed the title refactor(test): add login_as_admin in global conftest refactor(test): add login_as_admin to global conftest Jul 13, 2022
@ktmud ktmud force-pushed the login-as-fixture-in-conftest branch 8 times, most recently from c0164e1 to 8aa2f77 Compare July 13, 2022 22:45
@codecov
Copy link

codecov bot commented Jul 13, 2022

Codecov Report

Merging #20703 (ee7847c) into master (5beb1aa) will decrease coverage by 0.16%.
The diff coverage is 100.00%.

❗ Current head ee7847c differs from pull request most recent head b20260e. Consider uploading reports for the commit b20260e to get more accurate results

@@            Coverage Diff             @@
##           master   #20703      +/-   ##
==========================================
- Coverage   66.83%   66.67%   -0.17%     
==========================================
  Files        1750     1750              
  Lines       65894    65896       +2     
  Branches     7017     7017              
==========================================
- Hits        44041    43936     -105     
- Misses      20067    20174     +107     
  Partials     1786     1786              
Flag Coverage Δ
hive ?
mysql 82.47% <100.00%> (-0.01%) ⬇️
postgres 82.54% <100.00%> (-0.01%) ⬇️
presto ?
python 82.65% <100.00%> (-0.34%) ⬇️
sqlite 82.35% <100.00%> (+0.01%) ⬆️
unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/views/core.py 77.89% <ø> (+0.52%) ⬆️
superset/examples/birth_names.py 72.07% <100.00%> (+0.51%) ⬆️
superset/db_engines/hive.py 0.00% <0.00%> (-85.19%) ⬇️
superset/db_engine_specs/hive.py 70.00% <0.00%> (-15.77%) ⬇️
superset/db_engine_specs/presto.py 83.64% <0.00%> (-5.39%) ⬇️
superset/initialization/__init__.py 89.93% <0.00%> (-1.74%) ⬇️
superset/utils/log.py 93.70% <0.00%> (-1.40%) ⬇️
superset/connectors/sqla/models.py 89.17% <0.00%> (-1.15%) ⬇️
superset/db_engine_specs/base.py 88.00% <0.00%> (-0.34%) ⬇️
superset/models/core.py 88.91% <0.00%> (-0.25%) ⬇️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5beb1aa...b20260e. Read the comment docs.

@ktmud ktmud force-pushed the login-as-fixture-in-conftest branch 14 times, most recently from f35101e to cbcd013 Compare July 14, 2022 18:55
@@ -1979,6 +1979,8 @@ def dashboard(
return self.render_template(
"superset/spa.html",
entry="spa",
# dashboard title is always visible
title=dashboard.dashboard_title,
Copy link
Member Author

Choose a reason for hiding this comment

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

The test case test_get_dashboard actually tests dashboard title in the HTML, but the spa doesn't output it anymore. I'm not sure why current master passes the CI. It throws a test error, too, when running locally on my machine.

@rusackas rusackas requested a review from eschutho July 14, 2022 19:04
@ktmud ktmud force-pushed the login-as-fixture-in-conftest branch 2 times, most recently from 5c09d99 to d0dad7b Compare July 14, 2022 19:18
@ktmud ktmud force-pushed the login-as-fixture-in-conftest branch 6 times, most recently from 6760188 to 9b82814 Compare July 14, 2022 22:44
chart["table"]["table_name"] or "",
]
).lower()
)
Copy link
Member Author

@ktmud ktmud Jul 14, 2022

Choose a reason for hiding this comment

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

Bycatch: asserting for entity counts is probably not a good idea---as the test database can be populated with different data for various reasons. We should test against the actual underlying function itself----which, in this case, is filtering by a couple of text fields.

I caught this because my refactoring failed to clean up charts added in the import/export tests, which has now been fixed.

@ktmud ktmud force-pushed the login-as-fixture-in-conftest branch from 9b82814 to a1ded4f Compare July 14, 2022 23:33
@ktmud ktmud force-pushed the login-as-fixture-in-conftest branch from a1ded4f to b20260e Compare July 15, 2022 00:26
Copy link
Member

@bkyryliuk bkyryliuk left a comment

Choose a reason for hiding this comment

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

nice refactor!

@ktmud ktmud merged commit 2cb4fd3 into apache:master Jul 15, 2022
@john-bodley john-bodley deleted the login-as-fixture-in-conftest branch February 17, 2023 22:16
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 labels Mar 13, 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/XL 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants