-
Notifications
You must be signed in to change notification settings - Fork 30
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: Remove duplicate names for resolvers and tests #527
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,7 @@ def test_save_terms_agreement_delegate_to_interactor(self, interactor_mock): | |
interactor_mock.assert_called_once_with(input_dict) | ||
|
||
@patch("codecov_auth.commands.owner.owner.StartTrialInteractor.execute") | ||
def test_cancel_trial_delegate_to_interactor(self, interactor_mock): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For all the resolvers, I just named them what the property was There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These changes weren't necessary though; just a cleanliness thing |
||
def test_start_trial_delegate_to_interactor(self, interactor_mock): | ||
org_username = "random_org" | ||
self.command.start_trial(org_username=org_username) | ||
interactor_mock.assert_called_once_with(org_username=org_username) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -628,36 +628,7 @@ def test_fetch_path_contents_unknown_path( | |
} | ||
|
||
@patch("services.report.build_report_from_commit") | ||
def test_fetch_path_contents_unknown_flags(self, report_mock): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this looked to be a duplicate of the below test that was never updated |
||
report_mock.return_value = MockReport() | ||
|
||
data = self.gql_request( | ||
query_files, | ||
variables={ | ||
"org": self.org.username, | ||
"repo": self.repo.name, | ||
"branch": self.branch.name, | ||
"path": "", | ||
"filters": {"flags": ["test-123"]}, | ||
}, | ||
) | ||
assert data == { | ||
"owner": { | ||
"repository": { | ||
"branch": { | ||
"head": { | ||
"pathContents": { | ||
"__typename": "UnknownFlags", | ||
"message": "No coverage with chosen flags", | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@patch("services.report.build_report_from_commit") | ||
def test_fetch_path_contents_unknown_flags(self, report_mock): | ||
def test_fetch_path_contents_unknown_flags_no_flags(self, report_mock): | ||
report_mock.return_value = MockNoFlagsReport() | ||
|
||
data = self.gql_request( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -979,68 +979,6 @@ def test_pull_comparison_no_comparison(self, compute_comparisons_mock): | |
|
||
compute_comparisons_mock.assert_called_once | ||
|
||
def test_pull_comparison_missing_head_report(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This and the following test are using deprecated patterns |
||
self.head_report.side_effect = comparison.MissingComparisonReport( | ||
"Missing head report" | ||
) | ||
|
||
query = """ | ||
pullId | ||
compareWithBase { | ||
... on Comparison { | ||
state | ||
impactedFilesDeprecated { | ||
headName | ||
} | ||
} | ||
} | ||
""" | ||
|
||
res = self.gql_request( | ||
base_query % (self.repository.name, self.pull.pullid, query), | ||
owner=self.owner, | ||
with_errors=True, | ||
) | ||
assert res["errors"] is not None | ||
assert res["errors"][0]["message"] == "Missing head report" | ||
assert ( | ||
res["data"]["me"]["owner"]["repository"]["pull"]["compareWithBase"][ | ||
"impactedFilesDeprecated" | ||
] | ||
is None | ||
) | ||
|
||
def test_pull_comparison_missing_base_report(self): | ||
self.base_report.side_effect = comparison.MissingComparisonReport( | ||
"Missing base report" | ||
) | ||
|
||
query = """ | ||
pullId | ||
compareWithBase { | ||
... on Comparison { | ||
state | ||
impactedFilesDeprecated { | ||
headName | ||
} | ||
} | ||
} | ||
""" | ||
|
||
res = self.gql_request( | ||
base_query % (self.repository.name, self.pull.pullid, query), | ||
owner=self.owner, | ||
with_errors=True, | ||
) | ||
assert res["errors"] is not None | ||
assert res["errors"][0]["message"] == "Missing base report" | ||
assert ( | ||
res["data"]["me"]["owner"]["repository"]["pull"]["compareWithBase"][ | ||
"impactedFilesDeprecated" | ||
] | ||
is None | ||
) | ||
|
||
def test_pull_comparison_missing_when_commit_comparison_state_is_errored(self): | ||
self.commit_comparison.state = CommitComparison.CommitComparisonStates.ERROR | ||
self.commit_comparison.save() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,7 +142,7 @@ def setUp(self): | |
self.comparison = Comparison(self.user, self.base_commit, self.head_commit) | ||
|
||
@patch("services.comparison.Comparison.base_report", new_callable=PropertyMock) | ||
def test_head_report(self, base_report_mock): | ||
def test_base_report(self, base_report_mock): | ||
report = sample_report() | ||
base_report_mock.return_value = report | ||
|
||
|
@@ -153,9 +153,9 @@ def test_head_report(self, base_report_mock): | |
} | ||
) | ||
component_comparison = ComponentComparison(self.comparison, component_go) | ||
assert component_comparison.head_report.files == ["file_1.go"] | ||
assert component_comparison.base_report.files == ["file_1.go"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. test wasn't actually looking at base_report |
||
assert ( | ||
component_comparison.head_report.totals.coverage | ||
component_comparison.base_report.totals.coverage | ||
== report.get("file_1.go").totals.coverage | ||
) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test looked to be an exact copy of the one above it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch