Add V1 endpoints for factory, machine, machine_type#24
Add V1 endpoints for factory, machine, machine_type#24
Conversation
…e method to use v1 endpints defined
…ine and get_machine_type
… log error inplace of print
mklein0
left a comment
There was a problem hiding this comment.
Could unit tests against https://demo-continuous.sightmachine.io/ be added? I think we can have basic username/password added to that tenant. We wouild just need to add the password for our list of secrets in repo, so if it needs to be changed we are aware of it.
|
A test using mocks against the requests library can be done with: https://requests-mock.readthedocs.io/en/latest/mocker.html |
…er_by with select and order_by, priorities with single char
Are we looking for new way of mocking request since monkeypatch of mock is already there or we are looking for an INTEGRATION test to test sdk code end to end for eg. `def test_get_machines(monkeypatch): ` in this code we are mocking, do we need to add more tests like this or do we need to use the sdk to test against demo-continuos from an end-user perspective? |
… the way exceptions were logged, add data type for check_kw, removed v0 endpoints
we are creating a separate ticket for this |
we are creating a separate ticket for this |
we are creating a separate ticket for this |
101a54e to
e3a0631
Compare
smsdk/client.py
Outdated
| if util_name in ['get_factories', 'get_machines', 'get_machine_types']: | ||
| # data = dict_to_df(getattr(cls, util_name)(*args, **sub_kwargs[0]), normalize) | ||
| return getattr(cls, util_name)(normalize, *args, **sub_kwargs[0]) |
There was a problem hiding this comment.
FYI, It it the way the current SDK is designed, but I dislike the need to need to inspect the method names to determine function signatures rather than leveraging the language and OO methods.
smsdk/client.py
Outdated
|
|
||
| # sub_kwargs = kwargs | ||
| if util_name in ['get_cycles', 'get_downtime', 'get_parts']: | ||
| if util_name in ['get_cycles', 'get_downtime', 'get_parts', 'get_factories', 'get_machines', 'get_machine_types']: |
There was a problem hiding this comment.
A useful combination of tools to see how well the code created has test coverage is:
- coverage
- diff-cover
ex.
coverage run -m pytest -vvv -s tests
coverage xml
diff-cover --compare-branch origin/master --html-report diff-report.html coverage.xml
xdg-open diff-report.html
The report given goes off the code vs the diff, but still useful.
|
I don't have any more comments on this. Approved |
| # raise ValueError("Error - {}".format(records)) | ||
| return records | ||
|
|
||
| def modify_input_params(self, **kwargs): |
There was a problem hiding this comment.
I might be missing something but it seems like all of these modify_input_params are the same. Is there a reason this isn't a util you import?
|
|
||
| return starttime_key, endtime_key | ||
|
|
||
| def _get_records_mongo_v1( |
There was a problem hiding this comment.
What does mongo in the function name mean?
There was a problem hiding this comment.
What is this module kept around for? What v0 interfaces remain?
Hi, Please review the PR, Thanks
https://sightmachine.atlassian.net/browse/MARS-7090