{"action":"created","issue":{"url":"https://api.github.com/repos/umutbozkurt/django-rest-framework-mongoengine/issues/177","repository_url":"https://api.github.com/repos/umutbozkurt/django-rest-framework-mongoengine","labels_url":"https://api.github.com/repos/umutbozkurt/django-rest-framework-mongoengine/issues/177/labels{/name}","comments_url":"https://api.github.com/repos/umutbozkurt/django-rest-framework-mongoengine/issues/177/comments","events_url":"https://api.github.com/repos/umutbozkurt/django-rest-framework-mongoengine/issues/177/events","html_url":"https://github.com/umutbozkurt/django-rest-framework-mongoengine/pull/177","id":161201595,"number":177,"title":"Travis CI and Codecov setup for Django-REST-Framework-Mongoengine","user":{"login":"BurkovBA","id":7602655,"avatar_url":"https://avatars.githubusercontent.com/u/7602655?v=3","gravatar_id":"","url":"https://api.github.com/users/BurkovBA","html_url":"https://github.com/BurkovBA","followers_url":"https://api.github.com/users/BurkovBA/followers","following_url":"https://api.github.com/users/BurkovBA/following{/other_user}","gists_url":"https://api.github.com/users/BurkovBA/gists{/gist_id}","starred_url":"https://api.github.com/users/BurkovBA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BurkovBA/subscriptions","organizations_url":"https://api.github.com/users/BurkovBA/orgs","repos_url":"https://api.github.com/users/BurkovBA/repos","events_url":"https://api.github.com/users/BurkovBA/events{/privacy}","received_events_url":"https://api.github.com/users/BurkovBA/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-06-20T13:59:49Z","updated_at":"2016-06-21T19:13:09Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/umutbozkurt/django-rest-framework-mongoengine/pulls/177","html_url":"https://github.com/umutbozkurt/django-rest-framework-mongoengine/pull/177","diff_url":"https://github.com/umutbozkurt/django-rest-framework-mongoengine/pull/177.diff","patch_url":"https://github.com/umutbozkurt/django-rest-framework-mongoengine/pull/177.patch"},"body":"Hi, mr. Qwiglydee and Umut Bozkurt, many thanks for the work, you're doing, guys!\r\n\r\nI created all the necessary files for Travis CI and Codecov configuration for DRF-Mongoengine and made them successfully do their job in my fork: https://github.com/BurkovBA/django-rest-framework-mongoengine (see green badges). The configuration is 99%-rip-off of Django-REST-Framework's with all the necessary modifications. I'll denote the non-trivial changes, I had to introduce:\r\n\r\n1. Had to rename `DumbDocument` to `PatchingDumbDocument` in `test_patching.py`. Reason for this is mongoengine's document registry. When you import a Document, it automatically registers itself in mongoengine's regsitry and will be known by its name there. As you have DumbDocument defined both in `tests/models.py` and in `tests/test_patching.py`, they clash in the registry, when pytest autodiscovers them, and `get_document()` function retrieves the wrong document, failing the tests. Thus, I renamed one of them.\r\n2. Python2 support: there were some minor incompatibilities with python2 in DRFM: `super()` can't be invoked without arguments in Python2 and `mock` module isn't a part of unittest in 2.7. For `mock`, I added conditional import, just as it is done in Django.\r\n3. Satisfy linter: there were some unused imports, formatting errors that flake8 cursed about, which I fixed. Also, `isort` was unhappy about the order of some imports; I've written a `.isort.cfg` for it. I also replaced isort's `--check-only` option, which fails the build, if isort is unhappy, with `--diff`, which complains, but doesn't fail.\r\n4. I created a separate requirements folder, just as it is done in DRF. It is used by `tox.ini` to customize build environments.\r\n5. I prepared the stub for Django1.10 testing and documentation build job. Unfortunately, DRFM documentation is not available in the repo, thus, I can't make it work.\r\n\r\nYou'll probably want your Travis CI and Codecov badges in `README.md` refer to your own Travis and Codecov accounts (currently, they refer to mine, as I had no other way to test them). Just ask Umut to regsiter this repo in Travis and Codecov with his github account.\r\n\r\nAll in all, your test coverage is very good, over 90%. Cheers!"},"comment":{"url":"https://api.github.com/repos/umutbozkurt/django-rest-framework-mongoengine/issues/comments/227541845","html_url":"https://github.com/umutbozkurt/django-rest-framework-mongoengine/pull/177#issuecomment-227541845","issue_url":"https://api.github.com/repos/umutbozkurt/django-rest-framework-mongoengine/issues/177","id":227541845,"user":{"login":"qwiglydee","id":285128,"avatar_url":"https://avatars.githubusercontent.com/u/285128?v=3","gravatar_id":"","url":"https://api.github.com/users/qwiglydee","html_url":"https://github.com/qwiglydee","followers_url":"https://api.github.com/users/qwiglydee/followers","following_url":"https://api.github.com/users/qwiglydee/following{/other_user}","gists_url":"https://api.github.com/users/qwiglydee/gists{/gist_id}","starred_url":"https://api.github.com/users/qwiglydee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qwiglydee/subscriptions","organizations_url":"https://api.github.com/users/qwiglydee/orgs","repos_url":"https://api.github.com/users/qwiglydee/repos","events_url":"https://api.github.com/users/qwiglydee/events{/privacy}","received_events_url":"https://api.github.com/users/qwiglydee/received_events","type":"User","site_admin":false},"created_at":"2016-06-21T19:13:09Z","updated_at":"2016-06-21T19:13:09Z","body":"The EmbeddedDocumentSerializer had been designed wrong way - the `.validated_data` returned instance of EmbeddedDocument (to simplify putting it into parent document).\r\n\r\nThe right way is to follow general API of normal `DocumentSerializer`: the `validated_data` should be a dictionary of (parsed and validated) attributes, and an instance of EmbeddedModel should be created/updated during call to `save`/`create`/`update`.\r\nThis way allows to use EmbeddedSerializer separately to implement nested or complicated APIs for embedded list items. (see new test_embedded.py::TestEmbeddedIntegration)\r\nThis was the matter of my recent changes.\r\n\r\nAs for your issue #175 you probably need to take TestCase from `test_dumb.py::TestIntegration`.\r\nAnd, keep in mind the difference between `serializer.data` and `serializer.validated_data`:\r\n`data` is dictionary of serialized primitive types, ready to be jsonified;\r\n`validated_data` is dictionary of parsed attribute values, ready to be passed to Model constructor.\r\nThus, ModelClass(**validated_data) creates unsaved instance of an object. Saving an instance is skipped for EmbeddedDocs."}}
{"actor":{"display_login":"qwiglydee"}}