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

Added more informative errors upon failures of the *upload* command #310

Merged
merged 9 commits into from
Mar 29, 2020

Conversation

bakatzir
Copy link
Member

@bakatzir bakatzir commented Mar 29, 2020

Status

Ready

Related Issues

fixes: https://github.com/demisto/etc/issues/23116

Description

in the issue

@bakatzir bakatzir requested a review from yaakovi March 29, 2020 09:46
@bakatzir bakatzir self-assigned this Mar 29, 2020
@coveralls
Copy link
Collaborator

coveralls commented Mar 29, 2020

Pull Request Test Coverage Report for Build 2143

  • 6 of 12 (50.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.4%) to 52.648%

Changes Missing Coverage Covered Lines Changed/Added Lines %
demisto_sdk/commands/upload/uploader.py 6 12 50.0%
Totals Coverage Status
Change from base Build 2126: 0.4%
Covered Lines: 3380
Relevant Lines: 6420

💛 - Coveralls

@@ -31,19 +31,26 @@ def upload(self):
except IndexError:
print_color('Error: Path input is not a valid package directory.', LOG_COLORS.RED)
return 1

except Exception as err:
print_color(str(err), LOG_COLORS.RED)
Copy link
Contributor

Choose a reason for hiding this comment

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

why not print_error?

except Exception as ex:
raise ex
except Exception as err:
print_color(str(err), LOG_COLORS.RED)
Copy link
Contributor

Choose a reason for hiding this comment

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

why not print_error?



@patch('demisto_client.configure')
def test_upload(mocked_configure=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

separate into two steps with indicative names:
test_upload_sanity
test_upload_invalid_server or test_upload_failure

optimal test: checking that an error is printed
you can try to mock print_color and check that the failure actually calls that function. I tried to in the past and it didn't work so I wouldn't have wasted time on it...

@bakatzir bakatzir requested a review from yaakovi March 29, 2020 19:55
@bakatzir bakatzir merged commit 2dc01eb into master Mar 29, 2020
@bakatzir bakatzir deleted the run_unify_error branch March 29, 2020 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants