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

  1. client creation
  2. post with UINT8 body
  3. put with body
  4. post with form data
  5. get with query string
  6. post with form data
  7. get with query string
  8. 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 using uint8(). This will prohibit further meddling with the request body on behalf of urlread2().

  • 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.