{ "info": { "author": "bprinty", "author_email": "bprinty@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4" ], "description": "Faux\n====\n\nQuick and easy server mocking.\n\n\nInstallation\n------------\n\nVia github:\n\n.. code-block:: bash\n\n ~$ git clone http://github.com/bprinty/faux.git\n ~$ cd faux\n ~$ python setup.py install\n\n\nVia pip:\n\n.. code-block:: bash\n\n ~$ pip install faux\n\n\nDocumentation\n-------------\n\nDocumentation for the package can be found `here `_.\n\n\nUsage\n-----\n\nThe `faux `_ provides utilities for mocking responses from external services during testing. With `faux`, you can easily serve a directory structure mocking url endpoints for an externally managed service and use that server for testing.\n\n\nHigh-Level\n++++++++++\n\nFor instance, if you have a directory structure that looks like the following:\n\n.. code-block::\n\n \u251c\u2500\u2500 _uuid\n \u251c\u2500\u2500 file\n \u2514\u2500\u2500 query/\n \u00a0 \u251c\u2500\u2500 data\n \u00a0 \u2514\u2500\u2500 arg=test\n\n\nWith the following as contents of the files in that directory structure:\n\n.. code-block::\n\n # _uuid\n {\n \"status\": \"ok\",\n \"city\": \"{{city}}\"\n }\n\n # file\n {\n \"status\": \"ok\",\n \"month\": \"{{month}}\",\n }\n\n # query/arg=test\n {\n \"status\": \"ok\",\n \"arg\": \"test\",\n \"digit\": {{random_digit}}\n }\n\n # query/data\n {\n \"status\": \"ok\",\n \"data\": \"test\"\n }\n\n\nEndpoints mirroring that file structure will be available:\n\n.. code-block:: python\n\n >>> import requests\n >>> r = requests.get('http://localhost:1234/4db5fd8c-8aa6-4c29-b979-dab3ce71e64e')\n >>> print(r.json())\n {\n \"status\": \"ok\",\n \"city\": \"Sacramento\",\n }\n\n >>> r = requests.get('http://localhost:1234/file')\n >>> print(r.json())\n {\n \"status\": \"ok\",\n \"month\": \"05\"\n }\n\n >>> r = requests.get('http://localhost:1234/query?arg=test')\n >>> print(r.json())\n {\n \"status\": \"ok\",\n \"arg\": \"test\",\n \"digit\": 4\n }\n\n >>> r = requests.get('http://localhost:1234/query/data')\n >>> print(r.json())\n {\n \"status\": \"ok\",\n \"data\": \"test\"\n }\n\n\nIt's also worth noting (alluded to above) that you can mock arbitrary data in your responses using methods from the `faker `_ library. Items like `{{city}}` and `{{month}}` above were automatically and randomly filled without outputs from a `faker.Faker()` object during the request.\n\nOne other special file above is the `_uuid` file, which will return data from the `_uuid` file whenever a uuid is included as part of the request.\n\n\n\nStarting a Server\n+++++++++++++++++\n\nFor the previous example, you can start the server on a specific port using::\n\n.. code-block:: bash\n\n ~$ faux serve -P 1234 /path/to/directory\n\n\n\nUsing Within Tests\n++++++++++++++++++\n\nOne of the most common paradigms for using this software is to mock a service during testing. To do so with this module, you can easily set up a py.test fixture that will run throughout your test session:\n\n.. code-block:: python\n\n import unittest\n import pytest\n\n RESOURCES = '/path/to/testing/resources'\n\n @pytest.fixture(scope='session')\n def server():\n \"\"\"\n Set up mock server for testing request caching.\n \"\"\"\n from faux import Server\n app = Server(__name__, cache=RESOURCES)\n with app.run(port=1234):\n yield\n return\n\n\nOnce you've defined the fixture, you can use it on a test class or function like so:\n\n.. code-block:: python\n\n # test function\n @pytest.mark.usefixtures(\"server\")\n def test_function():\n return\n\n\n # test class\n @pytest.mark.usefixtures(\"server\")\n class TestClass(unittest.TestCase):\n def test_method():\n return\n\n\nWith the code above, the server you're mocking will run throughout your testing session and will gracefully exit when the test session stops.\n\n\nOther Functionality\n+++++++++++++++++++\n\nTo see other functionality provided by the library, please see the `documentation `_.\n\n\nQuestions/Feedback\n------------------\n\nFile an issue in the `GitHub issue tracker `_.\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bprinty/faux", "keywords": "faux", "license": "", "maintainer": "", "maintainer_email": "", "name": "faux", "package_url": "https://pypi.org/project/faux/", "platform": "", "project_url": "https://pypi.org/project/faux/", "project_urls": { "Homepage": "https://github.com/bprinty/faux" }, "release_url": "https://pypi.org/project/faux/0.0.7/", "requires_dist": [ "Flask (>=0.10.1)", "faker (>=1.0.1)" ], "requires_python": "", "summary": "Quick and easy server mocking.", "version": "0.0.7" }, "last_serial": 4767228, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "e923bd8c573d74e3c14651da432a2b19", "sha256": "e65d73775d3060cfb1105ed16860ee6b98197da2d9da62aa220e83fd4a04fcba" }, "downloads": -1, "filename": "faux-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e923bd8c573d74e3c14651da432a2b19", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7517, "upload_time": "2019-01-02T17:27:23", "url": "https://files.pythonhosted.org/packages/63/1b/1e69c9f1394c7daa56534afd3a7690b32efcc3feb56a427d35b831ffa33c/faux-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "657ced6766851e266d07b2b2c37aa600", "sha256": "02c16e6389ac04c1fcfbf26f74ba61de77e4b5539ed8d302fd289a2226e127b2" }, "downloads": -1, "filename": "faux-0.0.1.tar.gz", "has_sig": false, "md5_digest": "657ced6766851e266d07b2b2c37aa600", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16632, "upload_time": "2019-01-02T17:27:25", "url": "https://files.pythonhosted.org/packages/e8/f5/223ef26139c8688a06c5c4fc425ce1c3cf68f0c1adebc77d0f281b3f2f3e/faux-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "345a78c4eab9214e9ef3022b17a56ad0", "sha256": "4c40b379d011a08219299146ec7cec3be9b1c82cde44263ac5d8756914c8c862" }, "downloads": -1, "filename": "faux-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "345a78c4eab9214e9ef3022b17a56ad0", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8981, "upload_time": "2019-01-02T19:09:40", "url": "https://files.pythonhosted.org/packages/8a/f2/3ea3ab1c9fd8fa7c4e974581148c65754299ed741a86fb4f39364a4fc56c/faux-0.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "47f049bb33c4b223390e01c7d97b4bd6", "sha256": "ef3a086ad323d525887ac8eddb616db69d531be498e4de00833cc51b9ad48909" }, "downloads": -1, "filename": "faux-0.0.2.tar.gz", "has_sig": false, "md5_digest": "47f049bb33c4b223390e01c7d97b4bd6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18916, "upload_time": "2019-01-02T19:09:41", "url": "https://files.pythonhosted.org/packages/b5/1a/6df7130e29bfa8cea03992ddb5e14dceb93aee1ef106e113e4097ff25882/faux-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "81c8eaaf56eab4b7d59a0ec3e8dab5fc", "sha256": "3efadc7e51375c680f1cd0a1ee5c79ce09a00abc795d28bf686f6512a50e47d7" }, "downloads": -1, "filename": "faux-0.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "81c8eaaf56eab4b7d59a0ec3e8dab5fc", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10567, "upload_time": "2019-01-03T16:37:33", "url": "https://files.pythonhosted.org/packages/0d/6c/9aa3ad1ff9488bda716c179dcd4c64cd772172455e3796f11cfc30c54113/faux-0.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4e497d80f3779cfe0b0d103a653f7703", "sha256": "3a331331efc7a6e083637754efbc2fecd62c80803a51d12d96b20ea0c7c38cd7" }, "downloads": -1, "filename": "faux-0.0.3.tar.gz", "has_sig": false, "md5_digest": "4e497d80f3779cfe0b0d103a653f7703", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21227, "upload_time": "2019-01-03T16:37:35", "url": "https://files.pythonhosted.org/packages/96/cc/ee2be18a6377cf7aff95220c7fe609b362594d1d5097bf04dc6d4efbe1dc/faux-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "727e99120485f0b418734fc26282f82f", "sha256": "8c98e67ce0bc0c4df5ada6e89d5bd0adbaec6dcb43de4dfddbf6fd664097c518" }, "downloads": -1, "filename": "faux-0.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "727e99120485f0b418734fc26282f82f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10570, "upload_time": "2019-01-03T18:46:14", "url": "https://files.pythonhosted.org/packages/00/b0/5d954c178693dec8cb4ea5a92ed2897bca922414781ee1033dbf199ec1d1/faux-0.0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e7ceda1d28449fadde2826e445a3a1d5", "sha256": "f4be6919e7c324e03572f7656c3cfbedce3e70e5effaf18b9f7a4571bdb38a28" }, "downloads": -1, "filename": "faux-0.0.4.tar.gz", "has_sig": false, "md5_digest": "e7ceda1d28449fadde2826e445a3a1d5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21245, "upload_time": "2019-01-03T18:46:15", "url": "https://files.pythonhosted.org/packages/6d/4f/d369d44ea26f9ba3175bd94d48ab10bc555362d177a9458d6f4635914338/faux-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "bdeb46854745c185a8d21d02df323625", "sha256": "7e1c9a11ec288b70a4a1eef04c9e45e2806ab03ff507c8f9738480c227e1d51f" }, "downloads": -1, "filename": "faux-0.0.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "bdeb46854745c185a8d21d02df323625", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11324, "upload_time": "2019-01-03T22:34:18", "url": "https://files.pythonhosted.org/packages/8e/ea/0c4d34b0dc8554e464e6b37a8dab8264e9c62755810d49d2afedb849456d/faux-0.0.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cad00a39f6946b3b3ea0e4284bbc75c4", "sha256": "21a7e52a6a867c0399c705859795702a40b9ec1d01c18ef52cc2699bc5fd8b62" }, "downloads": -1, "filename": "faux-0.0.5.tar.gz", "has_sig": false, "md5_digest": "cad00a39f6946b3b3ea0e4284bbc75c4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21760, "upload_time": "2019-01-03T22:34:19", "url": "https://files.pythonhosted.org/packages/55/a7/1d4768b22db7632a018de66781162e257cc954a5e44b0601c9d2ea86fe8d/faux-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "e7d7dedf1647f2612ecd3ecf5d179b12", "sha256": "499efdbb7d6dfe68f97091532c34f106176bcf38103414d905ce9bfa79fb154e" }, "downloads": -1, "filename": "faux-0.0.6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e7d7dedf1647f2612ecd3ecf5d179b12", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9023, "upload_time": "2019-01-04T19:58:04", "url": "https://files.pythonhosted.org/packages/61/59/087a76a0c7bef0db1d059e8c05c218c8bee73c5280ee09a2cdf25280bfd8/faux-0.0.6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "79b7b71b0c2bdfd3c91935b8f730803c", "sha256": "404074e42fed0925c77dfbe542a63e03a2fd308e821ec491718579fcb74308b4" }, "downloads": -1, "filename": "faux-0.0.6.tar.gz", "has_sig": false, "md5_digest": "79b7b71b0c2bdfd3c91935b8f730803c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19142, "upload_time": "2019-01-04T19:58:05", "url": "https://files.pythonhosted.org/packages/16/a8/573ab1b83322c80b6d7c4e64518b44a95c3856f58039b04b60ca5c353770/faux-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "167df38d7db5a3a8358e023ef6d4a922", "sha256": "e3c67840040e96b5101cdf699374c24d329f3d72ef1615a7e8577421da288a72" }, "downloads": -1, "filename": "faux-0.0.7-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "167df38d7db5a3a8358e023ef6d4a922", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10622, "upload_time": "2019-02-01T07:15:19", "url": "https://files.pythonhosted.org/packages/c7/16/b213f696b3b2e6f885ff0da7f96c91b60ee8d0928ff1d52ebc28f9f2f3e5/faux-0.0.7-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b6772232f112dea5e4b802e46614a12e", "sha256": "5bff9d7d8c843f6f54128c894180627a379a1ef46c747a5dce77ddc007af84cd" }, "downloads": -1, "filename": "faux-0.0.7.tar.gz", "has_sig": false, "md5_digest": "b6772232f112dea5e4b802e46614a12e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21342, "upload_time": "2019-02-01T07:15:21", "url": "https://files.pythonhosted.org/packages/20/4c/ddc7b629652754b59a4feb4a3909affa6b528f14678f3d7a7107d0662932/faux-0.0.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "167df38d7db5a3a8358e023ef6d4a922", "sha256": "e3c67840040e96b5101cdf699374c24d329f3d72ef1615a7e8577421da288a72" }, "downloads": -1, "filename": "faux-0.0.7-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "167df38d7db5a3a8358e023ef6d4a922", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10622, "upload_time": "2019-02-01T07:15:19", "url": "https://files.pythonhosted.org/packages/c7/16/b213f696b3b2e6f885ff0da7f96c91b60ee8d0928ff1d52ebc28f9f2f3e5/faux-0.0.7-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b6772232f112dea5e4b802e46614a12e", "sha256": "5bff9d7d8c843f6f54128c894180627a379a1ef46c747a5dce77ddc007af84cd" }, "downloads": -1, "filename": "faux-0.0.7.tar.gz", "has_sig": false, "md5_digest": "b6772232f112dea5e4b802e46614a12e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21342, "upload_time": "2019-02-01T07:15:21", "url": "https://files.pythonhosted.org/packages/20/4c/ddc7b629652754b59a4feb4a3909affa6b528f14678f3d7a7107d0662932/faux-0.0.7.tar.gz" } ] }