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 account CLI commands and implementation #26

Merged
merged 4 commits into from
Apr 23, 2019

Conversation

dmytrostriletskyi
Copy link
Contributor

The following technical debt has been solved:

  • Move from fields validation using functions to custom fields.
  • Move details implementation from cli to service.
  • Install the package from the PypI through pip > Install the package from the PyPi through pip

@dmytrostriletskyi dmytrostriletskyi force-pushed the refactor-account branch 2 times, most recently from 739fcc3 to c451c5c Compare April 23, 2019 10:40
@codecov-io
Copy link

codecov-io commented Apr 23, 2019

Codecov Report

Merging #26 into develop will decrease coverage by 2.59%.
The diff coverage is 95.12%.

Impacted file tree graph

@@            Coverage Diff             @@
##           develop      #26     +/-   ##
==========================================
- Coverage    98.98%   96.39%   -2.6%     
==========================================
  Files            9       10      +1     
  Lines           99      111     +12     
==========================================
+ Hits            98      107      +9     
- Misses           1        4      +3
Impacted Files Coverage Δ
cli/account/interfaces.py 66.66% <100%> (ø) ⬆️
cli/account/service.py 100% <100%> (ø) ⬆️
cli/generic/forms/fields.py 100% <100%> (ø)
cli/account/help.py 100% <100%> (ø) ⬆️
cli/constants.py 100% <100%> (ø) ⬆️
cli/account/forms.py 100% <100%> (ø) ⬆️
cli/utils.py 91.66% <100%> (-8.34%) ⬇️
cli/account/cli.py 92% <75%> (-8%) ⬇️

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 a8cef2a...257a6af. Read the comment docs.

@dmytrostriletskyi dmytrostriletskyi force-pushed the refactor-account branch 3 times, most recently from 6b7a489 to 7e80de0 Compare April 23, 2019 13:23
balance = loop.run_until_complete(account_service.get_balance(address=address))
result, errors = Account(service=remme).get_balance(address=address)

if errors is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why it's needed here, if Account(service=remme).get_balance(address=address) always return error=None.

Copy link
Contributor Author

@dmytrostriletskyi dmytrostriletskyi Apr 23, 2019

Choose a reason for hiding this comment

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

@Alladin9393, I think, In the future, we will have general exception cathing in every service. Could we leave it here although there are no errors for now?

Copy link
Contributor

Choose a reason for hiding this comment

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


if re.match(pattern=DOMAIN_NAME_REGEXP, string=node_url) is None:
raise ValidationError(f'The following node URL `{node_url}` is invalid.')
address = AccountAddressField(required=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an extra check.

Suggested change
address = AccountAddressField(required=True)
address = AccountAddressField(required=False)

Because of click.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Alladin9393, imagine we will migrate this code from CLI to Web. Do we need to pay additional attention to how CLI handle arguments? No, we don't. We just need to cut the CLI. I mean forms do not know about the CLI.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Alladin9393
Copy link
Contributor

Account(service=remme).get_balance(address=address) can trow errors from library ( RpcGenericServerDefinedError and Connection error) add in future try/exp to cli/account/service.py get_balance.

@dmytrostriletskyi dmytrostriletskyi merged commit fcf353a into develop Apr 23, 2019
@delete-merged-branch delete-merged-branch bot deleted the refactor-account branch April 23, 2019 14:32
@dmytrostriletskyi dmytrostriletskyi mentioned this pull request May 2, 2019
11 tasks
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.

4 participants