-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add ability to use mock without passing in arguments #191
Add ability to use mock without passing in arguments #191
Conversation
Signed-off-by: Maysun J Faisal <[email protected]>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #191 +/- ##
==========================================
- Coverage 60.53% 60.46% -0.07%
==========================================
Files 43 43
Lines 5047 5061 +14
==========================================
+ Hits 3055 3060 +5
- Misses 1802 1810 +8
- Partials 190 191 +1 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Maysun J Faisal <[email protected]>
// So we should be adaptable and use the function params | ||
// and mock the output | ||
if util.IsGitProviderRepo(params.URL) { | ||
gc.MockGitURL.Host = params.URL |
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.
for this case, is it possible that gc.MockGitURL
is nil?
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.
Its not a pointer, I dont think we should check for nil here. Its a regular struct assignment.
mockGitUrl = gc.MockGitURL | ||
mockGitUrl.Token = gc.GitTestToken | ||
} | ||
} else if params.URL != "" { |
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.
can you add a test case for this block?
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, tests updated.
Signed-off-by: Maysun J Faisal <[email protected]>
name: "Case 6: Input url is valid with a mock client", | ||
client: MockDevfileUtilsClient{MockGitURL: util.MockGitUrl{Host: server.URL}, DownloadOptions: util.MockDownloadOptions{MockFile: "OK"}}, | ||
name: "Case 6: Input url is valid with a mock client, dont use mock data during invocation", | ||
client: MockDevfileUtilsClient{}, | ||
url: server.URL, |
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.
are we able to test a gitURL?
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
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.
since you add support for empty client, should add new unit test for your change, not editing the existing tests. the empty client case you added, needs a gitURL?
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.
I'll add a Github URL
Signed-off-by: Maysun J Faisal <[email protected]>
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.
looks good to me
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: maysunfaisal, yangcao77 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What does this PR do?:
Which issue(s) this PR fixes:
PR acceptance criteria:
Testing and documentation do not need to be complete in order for this PR to be approved. We just need to ensure tracking issues are opened and linked to this PR, if they are not in the PR scope due to various constraints.
Unit/Functional tests
QE Integration test
Documentation (READMEs, Product Docs, Blogs, Education Modules, etc.)
Client Impact
Gosec scans
How to test changes / Special notes to the reviewer:
tests should pass