Tests¶
The primary test target would be the client code generation. Instead, I focused on creating an example which will test the client functionality against the perstore API.
test_petstore_play_book
could serve as a starting point to write your own tests.
-
swagccg.tests.
test_petstore_play_book
(confi_path)¶ wrapper around the core logic which currently consists of 8 tests: %will be updated / refactored
- client creation
- post with UINT8 body
- put with body
- post with form data
- get with query string
- post with form data
- get with query string
- delete with path param and query string
- Gotchas:
Since the current version is dependent on
urlread2()
, the body content of a request should be encoded usinguint8()
. This will prohibit further meddling with the request body on behalf ofurlread2()
.The URL of Some ressources require the usage of path parameters:
sprintf('%d', PET_ID)
A formatting string (e.g.
%d
) is required since the tool in its current conditon doesn’t parse/store the data type of the parameter.
Todo
implemented = false;
refers to the usage of structs rather than cellstrings.struct2cell()
Final notes on Tests¶
The tests are incomplete and avoid MatLab built-in because the author is spoiled by PyTest.