{ "info": { "author": "Zach Kanzler", "author_email": "zkanzler@hivelocity.net", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "Natural Language :: English", "Operating System :: OS Independent", "Topic :: Software Development :: Testing" ], "description": "pytest-ubersmith\n================\nMock out calls to the python-ubersmith library\n\n\nUsage\n-----\n\npytest-ubersmith makes it really easy to mock out API calls:\n\n.. code-block:: python\n\n import ubersmith.client\n\n def test_add_client(ubermock):\n client_id = 1234\n ubermock.client.add = client_id\n\n assert ubersmith.client.add(login='test', password='abc') == 1234\n \n # Easy checking of calls\n assert ubermock.client.add.called\n assert ubermock.client.add.call_count == 1\n ubermock.client.add.assert_called_once_with(login='test')\n ubermock.client.add.assert_called_once_with_exactly(login='test', \n password='abc')\n\nTo have python-ubersmith raise a ResponseError, return an\n`ubermock.ResponseError`:\n\n.. code-block:: python\n\n import ubersmith.client\n import ubersmith.exceptions\n\n def test_unknown_client(ubermock):\n ubermock.client.get = ubermock.ResponseError('Invalid client!', 1)\n\n with pytest.raises(ubersmith.exceptions.ResponseError):\n ubersmith.client.get(client_id=1234)\n\nIf you need complete control over the response, you can return the whole\nUbersmith JSON response:\n\n.. code-block:: python\n\n import pytest\n import ubersmith.client\n import ubersmith.exceptions\n\n def test_unknown_client_raw(ubermock):\n ubermock.client.get.raw_response = {\n 'status': False,\n 'data': '',\n 'error_message': 'Invalid client',\n 'error_code': 1,\n }\n\n with pytest.raises(ubersmith.exceptions.ResponseError):\n ubersmith.client.get(client_id=1234)\n\nYou can even pass a callable for dynamic responses:\n\n.. code-block:: python\n\n import pytest\n import ubersmith.client\n import ubersmith.exceptions\n\n def test_dynamic_client(ubermock):\n def get_client(method, params, request, context):\n if params['client_id'] == '1':\n return {'client_id': 1}\n else:\n raise ubermock.ResponseError('Invalid client!', 1)\n\n ubermock.client.get = get_client\n \n assert ubersmith.client.get(client_id=1) == {'client_id': 1}\n with pytest.raises(ubersmith.exceptions.ResponseError):\n ubersmith.client.get(client_id=2)", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/hivelocity/pytest-ubersmith", "keywords": null, "license": "MIT License", "maintainer": null, "maintainer_email": null, "name": "pytest-ubersmith", "package_url": "https://pypi.org/project/pytest-ubersmith/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pytest-ubersmith/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/hivelocity/pytest-ubersmith" }, "release_url": "https://pypi.org/project/pytest-ubersmith/1.2.0/", "requires_dist": null, "requires_python": null, "summary": "Easily mock calls to ubersmith at the `requests` level.", "version": "1.2.0" }, "last_serial": 1503952, "releases": { "1.0.0": [], "1.0.1": [ { "comment_text": "", "digests": { "md5": "19f4d936490469c2ab0db9b1be29aacf", "sha256": "ad4e7fbcb84332fda7247debe06477cccd7e8423b8bfff32634e33cc9ba2d215" }, "downloads": -1, "filename": "pytest-ubersmith-1.0.1.tar.gz", "has_sig": false, "md5_digest": "19f4d936490469c2ab0db9b1be29aacf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4022, "upload_time": "2015-04-13T20:03:02", "url": "https://files.pythonhosted.org/packages/bf/dd/366528f7c2f8555a32b2dcec34084d2d8638a13f197feb49ee9fb9fbd0e4/pytest-ubersmith-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "79aa26914c33f5b00aeea89e744ab0e7", "sha256": "f7c5080f54df6c987d117d0ce0bed801fe0342c05e90573bd83e55457815c14d" }, "downloads": -1, "filename": "pytest-ubersmith-1.0.2.tar.gz", "has_sig": false, "md5_digest": "79aa26914c33f5b00aeea89e744ab0e7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4033, "upload_time": "2015-04-13T20:16:47", "url": "https://files.pythonhosted.org/packages/b2/15/094617fd5233be23366f8b6e6caea9f948a3c2b2efc0d4ad59f89793b54d/pytest-ubersmith-1.0.2.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "d34a82ebf84944181fb43fc1e290c4ee", "sha256": "d3fa79ba33881dbe09658587cb49ecca1b685ca872eb444782e63d90a3e0fae4" }, "downloads": -1, "filename": "pytest-ubersmith-1.1.0.tar.gz", "has_sig": false, "md5_digest": "d34a82ebf84944181fb43fc1e290c4ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4578, "upload_time": "2015-04-13T22:16:06", "url": "https://files.pythonhosted.org/packages/7d/2e/ea4bf541a67aafd1c14d6a83d32701f69edfba840f8d61d1ac234dd39c7c/pytest-ubersmith-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "0a5b82853d083a7d0ff1351b7b6d87e0", "sha256": "c5962bf0d815cccc94cc75914ca0821505b388eaa5b69b37e71b10daef9628d5" }, "downloads": -1, "filename": "pytest-ubersmith-1.2.0.tar.gz", "has_sig": false, "md5_digest": "0a5b82853d083a7d0ff1351b7b6d87e0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5465, "upload_time": "2015-04-13T23:14:04", "url": "https://files.pythonhosted.org/packages/a7/be/99142b40cf55037cac33883d8d55e7302ced556ff8f310765d8de90a1ac4/pytest-ubersmith-1.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0a5b82853d083a7d0ff1351b7b6d87e0", "sha256": "c5962bf0d815cccc94cc75914ca0821505b388eaa5b69b37e71b10daef9628d5" }, "downloads": -1, "filename": "pytest-ubersmith-1.2.0.tar.gz", "has_sig": false, "md5_digest": "0a5b82853d083a7d0ff1351b7b6d87e0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5465, "upload_time": "2015-04-13T23:14:04", "url": "https://files.pythonhosted.org/packages/a7/be/99142b40cf55037cac33883d8d55e7302ced556ff8f310765d8de90a1ac4/pytest-ubersmith-1.2.0.tar.gz" } ] }