Skip to content

Bug fix for deserialize model issue and added unit tests for python client #680

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

Merged
merged 4 commits into from
May 5, 2015

Conversation

geekerzp
Copy link
Contributor

  • Fixed deserializing model issue in python client.
    Before fixing, we import the models in swagger.py like this from models import *.
    So we can get the model class like this pet.Pet (the first pet is the module name).
    But in swagger.py 214 line objClass = eval(objClass + '.' + objClass),
    https://github.com/swagger-api/swagger-codegen/pull/680/files#diff-7356954fd07cc52ba5ac73153eb27cd8L214.
    It will evaluate Pet.Pet to get the model class which is incorrect.
    After fixing, we import the models in swagger.py like this import models.
    We can get the model class like this models.Pet.
    objClass = eval('models.' + objClass) will get the correct class.
  • Added unit testing for python client and added pom.xml.
    Below is the result:
  SwaggerPetstore-python(develop_2.0_python_testing) ✗: mvn integration-test -rf :PythonPetstoreClientTests
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Python Swagger Petstore Client 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:copy-dependencies (default) @ PythonPetstoreClientTests ---
[INFO]
[INFO] --- exec-maven-plugin:1.2.1:exec (nose-install) @ PythonPetstoreClientTests ---
Requirement already satisfied (use --upgrade to upgrade): nose in /usr/local/lib/python2.7/site-packages
[INFO]
[INFO] --- exec-maven-plugin:1.2.1:exec (nose-test) @ PythonPetstoreClientTests ---
test_1_add_pet (tests.test_pet_api.PetApiTests) ... ok
test_2_get_pet_by_id (tests.test_pet_api.PetApiTests) ... ok
test_3_update_pet (tests.test_pet_api.PetApiTests) ... ok
test_4_find_pets_by_status (tests.test_pet_api.PetApiTests) ... ok
test_5_find_pets_by_tags (tests.test_pet_api.PetApiTests) ... ok
test_6_update_pet_with_form (tests.test_pet_api.PetApiTests) ... ok
test_7_upload_file (tests.test_pet_api.PetApiTests) ... ok
test_8_delete_pet (tests.test_pet_api.PetApiTests) ... ok

----------------------------------------------------------------------
Ran 8 tests in 14.839s

OK
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.996 s
[INFO] Finished at: 2015-04-23T18:18:03+08:00
[INFO] Final Memory: 11M/156M
[INFO] ------------------------------------------------------------------------

@geekerzp geekerzp changed the title Added unit tests for python client. Bug fix for deserialize model issue and added unit tests for python client Apr 23, 2015
@fehguy
Copy link
Contributor

fehguy commented May 5, 2015

awesome contrib as always, and special (?) thanks for the hello kitty.

fehguy added a commit that referenced this pull request May 5, 2015
Bug fix for deserialize model issue and added unit tests for python client
@fehguy fehguy merged commit 65097a4 into swagger-api:develop_2.0 May 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants