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

test: Add test for export-roles --indent's argument “duck casting” to int #1811

Merged
merged 3 commits into from
Feb 24, 2022

Conversation

EBoisseauSierra
Copy link
Contributor

Description

#1724 introduced the --indent argument to fab export-roles. This (optional) argument accepts int and str args — and notably negative integers.

However, fab export-roles --indent=-1 would naturally return -1… as a str, and not a negative int. That's why we “duck cast” the arg to an integer… if possible.

This piece of logic remained however untested. So for the sake of the exercise, this PR:

  • extracts the duck casting logic into an ad hoc method,
  • create tests for this method.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Is CRUD MVC related.
  • Is Auth, RBAC security related.
  • Changes the security db schema.
  • Introduces new feature
  • Removes existing feature

so that we can easily test it.

Signed-off-by: Étienne Boisseau-Sierra <[email protected]>
Signed-off-by: Étienne Boisseau-Sierra <[email protected]>
@codecov
Copy link

codecov bot commented Feb 21, 2022

Codecov Report

Merging #1811 (5e1e134) into master (8a18281) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1811   +/-   ##
=======================================
  Coverage   77.11%   77.12%           
=======================================
  Files          56       56           
  Lines        8229     8232    +3     
=======================================
+ Hits         6346     6349    +3     
  Misses       1883     1883           
Flag Coverage Δ
python 77.12% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
flask_appbuilder/cli.py 58.92% <100.00%> (+0.55%) ⬆️

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 8a18281...5e1e134. Read the comment docs.

Signed-off-by: Étienne Boisseau-Sierra <[email protected]>
Copy link
Owner

@dpgaspar dpgaspar left a comment

Choose a reason for hiding this comment

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

Awesome! thank you

@dpgaspar dpgaspar merged commit 2d505e8 into dpgaspar:master Feb 24, 2022
@EBoisseauSierra EBoisseauSierra deleted the test_str_parse branch February 24, 2022 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants