{ "info": { "author": "Bill Van Der Laan", "author_email": "wvanderln@hotmail.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 modification of mblanton's nose plugin to facilitate the creation of automated tests that access Mongo Engine structures.\n:Repository: https://github.com/vanderln/nose-mongoengine/\n:PyPI page: http://pypi.python.org/pypi/nose-mongoengine/\n:Author: Bill Van Der Laan (http://github.com/vanderln)\n\n.. image:: https://secure.travis-ci.org/vanderln/nose-mongoengine.png?branch=master\n :target: http://travis-ci.org/vanderln/nose-mongoengine\n\nOriginally based on Mongo Nose ( http://pypi.python.org/pypi/mongonose/ ). Thanks to: M Blanton\n\n.. contents::\n\nInstallation\n============\n\nUsing pip:\n\n pip install nose-mongoengine-wait-time\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- ``--mongoengine-mongodb-wait-time`` Can optionally set the time to wait for mongodb to initialize\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/vanderln/nose-mongoengine/tarball/master", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/vanderln/nose-mongoengine/", "keywords": null, "license": "BSD-derived", "maintainer": null, "maintainer_email": null, "name": "nose-mongoengine-wait-time", "package_url": "https://pypi.org/project/nose-mongoengine-wait-time/", "platform": "any", "project_url": "https://pypi.org/project/nose-mongoengine-wait-time/", "project_urls": { "Download": "http://github.com/vanderln/nose-mongoengine/tarball/master", "Homepage": "http://github.com/vanderln/nose-mongoengine/" }, "release_url": "https://pypi.org/project/nose-mongoengine-wait-time/0.0.1/", "requires_dist": null, "requires_python": null, "summary": "A modification for the nose plugin to facilitate the creation of automated tests that access Mongo Engine structures.", "version": "0.0.1" }, "last_serial": 1874166, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "d503cc4805a609c4640a29c129822b36", "sha256": "268188bc83bce24f0af69a04ffd87e7168da007527bd172a07fb5010880c2a4e" }, "downloads": -1, "filename": "nose-mongoengine-wait-time-0.0.1.tar.gz", "has_sig": false, "md5_digest": "d503cc4805a609c4640a29c129822b36", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9315, "upload_time": "2015-12-22T18:38:34", "url": "https://files.pythonhosted.org/packages/f4/6c/205e676346e3f681010eff810ad9d45f7fe5a8f2ab51e3175045758c0bfe/nose-mongoengine-wait-time-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d503cc4805a609c4640a29c129822b36", "sha256": "268188bc83bce24f0af69a04ffd87e7168da007527bd172a07fb5010880c2a4e" }, "downloads": -1, "filename": "nose-mongoengine-wait-time-0.0.1.tar.gz", "has_sig": false, "md5_digest": "d503cc4805a609c4640a29c129822b36", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9315, "upload_time": "2015-12-22T18:38:34", "url": "https://files.pythonhosted.org/packages/f4/6c/205e676346e3f681010eff810ad9d45f7fe5a8f2ab51e3175045758c0bfe/nose-mongoengine-wait-time-0.0.1.tar.gz" } ] }