GET entrypoint of a workflow from st2client#4791
Conversation
|
On the "sync" stuff, i know i've brought it up before. I thought about generating the client from the swagger spec. However, there is some "custom" code that gets added on the client side for some of the stuff to make the human output "pretty". Would still be nice if there was a way for the end-client CLI to get all of the new features/flags and endpoints, even if it's basic support at first. |
arm4b
left a comment
There was a problem hiding this comment.
Changelog is missing. Would be good to have one for this fix.
m4dcoder
left a comment
There was a problem hiding this comment.
Minor addition required for unit tests.
|
|
||
| endpoint = '/actions/views/entry_point/%s' % EXECUTION['id'] | ||
|
|
||
| httpclient.HTTPClient.get.assert_called_with(endpoint) |
There was a problem hiding this comment.
Please add a unit tests where the status code from the API call is not OK/200.
There was a problem hiding this comment.
Pushed a commit for this, but not sure if I implemented it correctly, please let me know if I should take a different approach.
There was a problem hiding this comment.
Can you use assertRaisesRegexp and check that the error message is actually Not Found returned in the FakeResponse? Search for assertRaisesRegexp in st2 and you will see plenty of examples.
There was a problem hiding this comment.
@m4dcoder sorry for the delay, I've pushed a commit to use that method. Please let me know if it's not correct.
|
|
||
| endpoint = '/actions/views/entry_point/%s' % EXECUTION['id'] | ||
|
|
||
| httpclient.HTTPClient.get.assert_called_with(endpoint) |
There was a problem hiding this comment.
Can you use assertRaisesRegexp and check that the error message is actually Not Found returned in the FakeResponse? Search for assertRaisesRegexp in st2 and you will see plenty of examples.
m4dcoder
left a comment
There was a problem hiding this comment.
LGTM. Need CI jobs to pass before this can be merged.
|
@trstruth You also need to rebase this branch. There is a merge conflict. |
|
@m4dcoder I've resolved the conflict, let's see if the ci builds pass this time |
This PR implements a method in the st2client module which fetches the entrypoint of a given action ref/id. This is essentially a wrapper of this endpoint.
We use the st2client package fairly extensively to facilitate tight integration between some of our internal python services and st2. This PR is one of multiple which extend st2client to wrap more of the existing st2api endpoints which are already implemented.
Random thought - is there a way we can "sync" the api and the client? ie ensure that all of the api endpoints have a corresponding client method implemented?