-
Notifications
You must be signed in to change notification settings - Fork 0
Add dynamic service support #5
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
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 |
|---|---|---|
|
|
@@ -213,3 +213,41 @@ def test_missing_error_key(mockserver): | |
| ) | ||
| assert got.value.code == 0 | ||
| assert got.value.data == "" | ||
|
|
||
|
|
||
| ### | ||
| # Dynamic service tests | ||
| # | ||
| # All of the 3 ways of calling services use the same underlying _call method, so we don't | ||
| # reiterate those tests every time. | ||
| ### | ||
|
|
||
| def test_dynamic_service(url_and_token): | ||
| bc = sdk_baseclient.SDKBaseClient( | ||
| url_and_token[0] + "/services/service_wizard", lookup_url=True | ||
| ) | ||
| res = bc.call_method("HTMLFileSetServ.status", []) | ||
| del res["git_commit_hash"] | ||
| ver = res["version"] | ||
| del res["version"] | ||
| assert res == { | ||
| 'git_url': 'https://github.com/kbaseapps/HTMLFileSetServ', | ||
| 'message': '', | ||
| 'state': 'OK', | ||
| } | ||
|
Comment on lines
+233
to
+237
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. are these live calls or is there some mocking machinery hidden elsewhere in the file? Highly recommend vcrpy for testing against external services without having to test against external services.
Member
Author
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. They're live calls. I'd much rather test against a real service than a mock, especially when it's relatively easy like this case |
||
| assert semver.Version.parse(ver) > semver.Version.parse("0.0.8") | ||
|
|
||
|
|
||
| def test_dynamic_service_with_service_version(url_and_token): | ||
| # Current version of HFS is 0.0.9 everywhere | ||
| bc = sdk_baseclient.SDKBaseClient( | ||
| url_and_token[0] + "/services/service_wizard", lookup_url=True | ||
| ) | ||
| res = bc.call_method("HTMLFileSetServ.status", [], service_ver="0.0.8") | ||
| del res["git_commit_hash"] | ||
| assert res == { | ||
| 'git_url': 'https://github.com/kbaseapps/HTMLFileSetServ', | ||
| 'message': '', | ||
| 'state': 'OK', | ||
| "version": "0.0.8" | ||
| } | ||
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 is a direct port from the baseclient in the SDK, but looking at this now, it's be a good idea to put a ~1 min LRU cache around this part of the method at some point.