{ "info": { "author": "Marcelo Anton", "author_email": "marceloanton@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Plugins", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP" ], "description": "================\nnose-mongoengine\n================\n\n:Info: A nose plugin to facilitate the creation of automated tests that access Mongo Engine structures.\n:Repository: https://github.com/mbanton/nose-mongoengine/\n:PyPI page: http://pypi.python.org/pypi/nose-mongoengine/\n:Author: Marcelo Anton (http://github.com/mbanton) & Maxwell Dayvson ( https://github.com/dayvson/)\n\n.. image:: https://secure.travis-ci.org/mbanton/nose-mongoengine.png?branch=master\n :target: http://travis-ci.org/mbanton/nose-mongoengine\n\nOriginally based on Mongo Nose ( http://pypi.python.org/pypi/mongonose/ ). Thanks to: Kapil Thangavelu\n\n.. contents::\n\nInstallation\n============\n\nUsing pip:\n\n pip install nose-mongoengine\n\nConfiguration\n=============\n\nThe plugin extends the nose options with a few options. The only\nrequired options are either ``--mongoengine`` or ``--mongoengine-mongodb-bin`` to enable\nthe plugin.\n\n - ``--mongoengine`` is required to enable the plugin.\n\n - ``--mongoengine-mongodb-bin`` Allows specifying the path to the ``mongod`` binary.\n If not specified the plugin will search the path for a mongodb\n binary. If one is not found, an error will be raised.\n\n - ``--mongoengine-clear-after-module`` Optionally clear data in db after every module of tests.\n\n - ``--mongoengine-clear-after-class`` Optionally clear data in db after every class of tests.\n\n - ``--mongoengine-mongodb-port`` can be optionally set, by default the plugin\n will utilize a a random open port on the machine.\n\n - ``--mongoengine-mongodb-scripting`` Enables the javascript scripting engine,\n off by default.\n\n - ``--mongoengine-mongodb-logpath`` Stores the server log at the given path, by\n default sent to /dev/null\n\n - ``--mongoengine-mongodb-prealloc`` Enables pre-allocation of databases, default\n is off. Modern filesystems will sparsely allocate, which can\n speed up test execution.\n\n\nThe plugin will up a instance of Mongo Db and create a empty database to use it.\n\n\nUsage in your test cases\n========================\n\nSince this is your model using mongoengine ( model_one.py )::\n\n # encoding:utf-8 #\n from mongoengine import *\n \n class ModelOne(Document):\n int_value1 = IntField()\n int_value2 = IntField()\n boolean_value = BooleanField(required=True, default=False)\n \n @classmethod\n def get_model_one_by_value1(cls, v):\n return ModelOne.objects(int_value1=v)\n \n @classmethod\n def get_model_one_by_boolean_value(cls, v):\n return ModelOne.objects(boolean_value=v)\n\n\nThis is an example using the test nose + nose-mongoengine ( test_model_one.py )::\n\n # encoding:utf-8 #\n from model_one import ModelOne\n from nose.tools import assert_equals\n \n class TestModelOne(object):\n \n # This method run on instance of class\n @classmethod\n def setUpClass(cls):\n \n global o1_id, o2_id\n \n # Create two objects for test\n o1 = ModelOne()\n o1.int_value1 = 500\n o1.int_value2 = 123\n o1.boolean_value = True\n o1.save()\n \n o2 = ModelOne()\n o2.int_value1 = 500\n o2.int_value2 = 900\n o2.boolean_value = False\n o2.save()\n \n # Save the id of objects to match in the test\n o1_id = o1.id\n o2_id = o2.id\n \n # This method run on every test\n def setUp(self):\n global o1_id, o2_id\n self.o1_id = o1_id\n self.o2_id = o2_id\n \n def test_match_with_value1(self):\n find = ModelOne.get_model_one_by_value1(500)\n assert_equals(len(find), 2)\n assert_equals(find[0].id, self.o1_id)\n assert_equals(find[1].id, self.o2_id)\n \n def test_match_with_boolean_value(self):\n find = ModelOne.get_model_one_by_boolean_value(True)\n assert_equals(len(find), 1)\n assert_equals(find[0].id, self.o1_id)\n \n\nRun in the command line::\n\n\n $ nosetests --mongoengine test_model_one.py \n ..\n ----------------------------------------------------------------------\n Ran 2 tests in 0.054s\n \n OK", "description_content_type": null, "docs_url": null, "download_url": "http://github.com/mbanton/nose-mongoengine/tarball/master", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/mbanton/nose-mongoengine/", "keywords": null, "license": "BSD-derived", "maintainer": null, "maintainer_email": null, "name": "nose-mongoengine", "package_url": "https://pypi.org/project/nose-mongoengine/", "platform": "any", "project_url": "https://pypi.org/project/nose-mongoengine/", "project_urls": { "Download": "http://github.com/mbanton/nose-mongoengine/tarball/master", "Homepage": "http://github.com/mbanton/nose-mongoengine/" }, "release_url": "https://pypi.org/project/nose-mongoengine/0.2.2/", "requires_dist": null, "requires_python": null, "summary": "A nose plugin to facilitate the creation of automated tests that access Mongo Engine structures.", "version": "0.2.2" }, "last_serial": 1021139, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "8b522d49c18d8d124d09c81b2f9f06b4", "sha256": "8e86f3b83ba24776dd4255b6be59673828b48f38825d3866a1ca7933abdf8e72" }, "downloads": -1, "filename": "nose-mongoengine-0.2.0.tar.gz", "has_sig": false, "md5_digest": "8b522d49c18d8d124d09c81b2f9f06b4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9516, "upload_time": "2012-10-18T18:34:33", "url": "https://files.pythonhosted.org/packages/b1/21/8afa8cd6a51fced4675ff281b4330b1fb3cb9d4d430ea4896ba9ee7172d8/nose-mongoengine-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "5d82d0cdd2eb3285ba25c91c4a1e17a9", "sha256": "0688e648bc3788f3dc8cabd4226b8df6eac4be9248b60db8313490af66127d68" }, "downloads": -1, "filename": "nose-mongoengine-0.2.1.tar.gz", "has_sig": false, "md5_digest": "5d82d0cdd2eb3285ba25c91c4a1e17a9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9663, "upload_time": "2012-10-31T20:13:08", "url": "https://files.pythonhosted.org/packages/96/fa/df034d965bc2d8bd11e81769033eea7e177dc6cbd9ba47ff3a58c9c49f76/nose-mongoengine-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "4bcf83d0d05a943f4c1ccee410d228fb", "sha256": "1558921a0a60a41b04c075bbcb8ff49e235419410d4d0bd97834a9bd6fcf92a4" }, "downloads": -1, "filename": "nose-mongoengine-0.2.2.tar.gz", "has_sig": false, "md5_digest": "4bcf83d0d05a943f4c1ccee410d228fb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9397, "upload_time": "2014-03-06T13:54:23", "url": "https://files.pythonhosted.org/packages/d7/dc/1b2e54d2597e0294be76f0b7dbe58014210a1f29e369a4e2c5519744c2a5/nose-mongoengine-0.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4bcf83d0d05a943f4c1ccee410d228fb", "sha256": "1558921a0a60a41b04c075bbcb8ff49e235419410d4d0bd97834a9bd6fcf92a4" }, "downloads": -1, "filename": "nose-mongoengine-0.2.2.tar.gz", "has_sig": false, "md5_digest": "4bcf83d0d05a943f4c1ccee410d228fb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9397, "upload_time": "2014-03-06T13:54:23", "url": "https://files.pythonhosted.org/packages/d7/dc/1b2e54d2597e0294be76f0b7dbe58014210a1f29e369a4e2c5519744c2a5/nose-mongoengine-0.2.2.tar.gz" } ] }