{ "info": { "author": "Georges Racinet", "author_email": "gracinet@anybox.fr", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Topic :: Software Development :: Quality Assurance", "Topic :: Software Development :: Testing", "Topic :: System :: Benchmark" ], "description": "Funkload base test cases for Openerp\n====================================\n\nIntroduction\n~~~~~~~~~~~~\nThis package provides the ``OpenERPTestCase`` class, subclassing\n``FunkloadTestCase`` with methods tailored for OpenERP functionnal and\nload testing through the XML-RPC or JSON-RPC APIs.\n\nIt features login and user management facilities, and pythonic\nencapsulation of API calls through the ``*ModelProxy`` classes.\n\nFor a detailed example, see the included ``test_sales_order.py`` test\ncase.\n\nBasic user handling\n~~~~~~~~~~~~~~~~~~~\n\nFunkload can create if needed users with given groups and login as\nthem. Note how groups are specified as fully qualified references from\n``ir.model.data``::\n\n from anybox.funkload.openerp import OpenERPTestCase\n\n class MyTestCase(OpenERPTestCase):\n\n def test_01_makeuser(self):\n self.login('admin', 'admin')\n self.ensure_user('spam', 'spampassword', ['base.group_sale_manager'])\n\n def test_02_my_usecase(self):\n self.login('spam', 'spampassword')\n ...\n\nIt is a common practice to use a test case to prepare the\ndatabase. ``fl-run-test`` loads them in alphabetical order.\n\nUser handling through Funkload's credential server\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nFunkload provides an external and optional credentials server. This is\na facility that you are in no way forced to use.\n\nThe principle is to serve logins, passwords, and groups, loaded from separate\nexternal ``users.txt`` and ``groups.txt`` files. Groups in that sense\nare thought as groups of users, which is a slightly different\nphilosophy as OpenERP's but it doesn't matter much.\n\nOpenERPTestCase provides a login method that selects an user from the\nwished group from the credential server::\n\n def test_my_usecase(self):\n self.login_as_group('base.group_sale_manager')\n # now test some scenario\n\nOf course that means that the names of groups must also be consistent\nin ``groups.txt.``. See the provided ``users.txt`` and ``groups.txt``\nfiles.\n\nThere is also a method ``ensure_credential_server_users()`` that\ncreates all wished users with the appropriate groups.\n\nAPI calls\n~~~~~~~~~\nThe principle is to get a ``ModelProxy`` instance, that'll encapsulate\nall regular (so-called ORM) calls::\n\n def test_my_usecase(self):\n \"\"\"First list all customers, then...\"\"\"\n self.login('user', 'password')\n res_partner = self.model('res.partner')\n res_partner.model.search([('customer', '=', 'True')],\n description=\"Search customers\")\n\nThe description will end up as request title in the Funkload bench report\n\nWorkflow calls\n~~~~~~~~~~~~~~\n\nThe ``ModelProxy`` instances provided by the ``model()`` method can\nalso perform workflow's trigger validate::\n\n def test_my_usecase(self):\n # some preparations, then confirm Sale Order #1234\n model = self.model('sale.order')\n model.workflow('order_confirm')(1234,\n description=\"Confirm Sale Order\")\n\nAs before, the description if for the bench report.\n\nJSON-RPC\n~~~~~~~~\nAs of version 0.2, ``OpenERPTestCase`` provides helpers for JSON-RPC\nsessions (similar to those a browser would initiate) and calls.\n\nThe sessions are totally independent from XML-RPC ones. You need to\nperform a separate login operation::\n\n self.web_login('user', 'password')\n\nThen you can get a ``JsonModelProxy``, and access to ORM methods (in\nsome cases this may behave slightly differently than XML-RPC)::\n\n model = self.model('sale.order', rpc='json')\n model.search([('customer', '=', 'True')], description=\"Search customers\")\n\nSome web-specific methods are directly exposed. The following is akin\nto what the JavaScript web client would do::\n\n fields = ('name', 'street', 'city', 'zip')\n model.search_read([('customer', '=', True)], fields,\n description=\"Fetch customer addresses\")\n\nActually, that was the only web-specific method currently\navailable. More will presumably appear in the forthcoming releases.\n\n.. note:: this JSON-RPC OpenERP implementation currently supports\n OpenERP v7.0 only. API changes are scheduled for later\n OpenERP versions (thanks to Anthony Lesuisse for pointing\n that out).\n\n\nReferences\n~~~~~~~~~~\n\nThe ``OpenERPTestCase`` class has the ``ref()`` method, to retrieve an\nobject id from the reference code, as in XML or YML files, namely from\n``ir.model.data``::\n\n def test_my_usecase(self):\n product_id = self.ref('product.product', 'stock', \n\nAcknowledgment\n~~~~~~~~~~~~~~\nThe very simple wrapping provided by ``ModelProxy`` is inspired by the\nOpenObject library.\n\nTips for benchmarking\n~~~~~~~~~~~~~~~~~~~~~\n\nRandomize as much as you can. Notably, you *must avoid* repeated\nlogins with the same user : this spawns database conflicts, putting\nsome test runs in error state, but also making them very fast, hence\nmaking you stats unusable.\n\nAnything that's in ``setUp()`` is outside of performance\nmeasurements. See how the provided ``test_sales_orders`` preloads\navailable customers and sellable products once for all for each\nvirtual user.\n\n.. Emacs\n.. Local Variables:\n.. mode: rst\n.. End:\n.. Vim\n.. vim: set filetype=rst:\n\n\n\n\n\n\n\n\n\nVersion 0.2 (2013-07-01)\n------------------------\n\n - launchpad #1196284: allow specification of an environment variable as db_name\n - launchpad #1195416: pass keyword arguments to OpenERP server methods\n - launchpad #1196243: basic JSON-RPC support\n\nVersion 0.1 (2012-07-15)\n------------------------\nInitial version", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://launchpad.net/anybox.funkload.openerp", "keywords": null, "license": "GPLv3", "maintainer": null, "maintainer_email": null, "name": "anybox.funkload.openerp", "package_url": "https://pypi.org/project/anybox.funkload.openerp/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/anybox.funkload.openerp/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://launchpad.net/anybox.funkload.openerp" }, "release_url": "https://pypi.org/project/anybox.funkload.openerp/0.2/", "requires_dist": null, "requires_python": null, "summary": "Base classes for functional and load testing of OpenERP with Funkload", "version": "0.2" }, "last_serial": 783668, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "bcde3cc012530576f399800536a83bcb", "sha256": "e6b245f6840c3da1f7f7f70e38a93255fc43c6b6b6308bddac3e606a7abad6b1" }, "downloads": -1, "filename": "anybox.funkload.openerp-0.1.tar.gz", "has_sig": false, "md5_digest": "bcde3cc012530576f399800536a83bcb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5361, "upload_time": "2012-07-15T14:20:45", "url": "https://files.pythonhosted.org/packages/a7/11/573aee9b60506fcf587b7f8786be2a910b1742370905bbf862dad76e5558/anybox.funkload.openerp-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "be7c51cf3c2c23e4d5fbbecd2e80df90", "sha256": "2b1837b5a51f0a064d5e61219a444a34dacd42f64505f46fb5d6f0a4d865b5dd" }, "downloads": -1, "filename": "anybox.funkload.openerp-0.2.tar.gz", "has_sig": false, "md5_digest": "be7c51cf3c2c23e4d5fbbecd2e80df90", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6707, "upload_time": "2013-07-01T12:05:52", "url": "https://files.pythonhosted.org/packages/9f/ee/a8d0093d774d821dd275dbe20bea2f39c69b303e69e12576eba045dd9711/anybox.funkload.openerp-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "be7c51cf3c2c23e4d5fbbecd2e80df90", "sha256": "2b1837b5a51f0a064d5e61219a444a34dacd42f64505f46fb5d6f0a4d865b5dd" }, "downloads": -1, "filename": "anybox.funkload.openerp-0.2.tar.gz", "has_sig": false, "md5_digest": "be7c51cf3c2c23e4d5fbbecd2e80df90", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6707, "upload_time": "2013-07-01T12:05:52", "url": "https://files.pythonhosted.org/packages/9f/ee/a8d0093d774d821dd275dbe20bea2f39c69b303e69e12576eba045dd9711/anybox.funkload.openerp-0.2.tar.gz" } ] }