{ "info": { "author": "Chris Martin", "author_email": "ch.martin@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "Usage\n-----\n\nThe intended use is for making sure your unit tests don't make network\nconnections. Activate ``sockfilter`` with a predicate like:\n\n.. code:: python\n\n # only allow http connections to localhost\n def socket_address_allowed(address):\n return (address.host in ['localhost', '127.0.0.1'] and\n address.port == 80)\n\n sockfilter.enable(socket_address_allowed)\n\nAny subsequent attempts to open a connection at an address not satisfying\nthe predicate will raise ``sockfilter.SockFilterError``.\n\n\n``with_sockfiltering`` decorator\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n from sockfilter import with_sockfiltering\n\n @with_sockfiltering(socket_address_allowed)\n def test_foo():\n foo()\n\n\n``sockfiltering`` context manager\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n from sockfilter import sockfiltering\n\n def test_foo():\n with sockfiltering(socket_address_allowed):\n foo()\n\n\n``enable`` and ``disable``\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n import sockfilter\n from unittest import TestCase\n\n class FooTest(TestCase):\n\n def setUp(self):\n sockfilter.enable(socket_address_allowed)\n\n def tearDown(self):\n sockfilter.disable()\n\n def test_foo(self):\n foo()\n\n\nUnder the hood\n--------------\n\nSockfilter works by monkey-patching Python's ``socket`` library,\ninspired by HTTPretty_.\n\n.. _HTTPretty: https://github.com/gabrielfalcao/HTTPretty", "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/cardforcoin/sockfilter", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "sockfilter", "package_url": "https://pypi.org/project/sockfilter/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/sockfilter/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/cardforcoin/sockfilter" }, "release_url": "https://pypi.org/project/sockfilter/1.4/", "requires_dist": null, "requires_python": null, "summary": "Block socket creation by host/port.", "version": "1.4" }, "last_serial": 1151594, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "9985441df054697623ca5e20c95e05a3", "sha256": "ab795ff5363080224e3f321da7f22d2e82926e77692f67ea00a54add3110d81d" }, "downloads": -1, "filename": "sockfilter-1.0.tar.gz", "has_sig": false, "md5_digest": "9985441df054697623ca5e20c95e05a3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1829, "upload_time": "2014-07-08T21:28:36", "url": "https://files.pythonhosted.org/packages/4c/28/fbd294ed763ea831ef9e82280e212f7030b5cdca487b2c8af7e203a09e9a/sockfilter-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "431fe6a88a693ec20faf2e5111c34c5f", "sha256": "420a41bf6c9dcdc30d1b107f65d2905f6b513db11b3cfff81660ff3d62e95208" }, "downloads": -1, "filename": "sockfilter-1.1.tar.gz", "has_sig": false, "md5_digest": "431fe6a88a693ec20faf2e5111c34c5f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1833, "upload_time": "2014-07-08T21:38:15", "url": "https://files.pythonhosted.org/packages/74/d3/24eb5fc4c65d064a72702e31fdf395feb17546c4dd92301443471ca9f7dc/sockfilter-1.1.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "4cd3124af39f2985679ced3b74c9ab30", "sha256": "239d7da69dba0e550ba0c5a93d970a8799fafe8084ef18e03bcdf90cdd8fb741" }, "downloads": -1, "filename": "sockfilter-1.2.tar.gz", "has_sig": false, "md5_digest": "4cd3124af39f2985679ced3b74c9ab30", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1959, "upload_time": "2014-07-08T22:22:04", "url": "https://files.pythonhosted.org/packages/03/57/6ae6706ba6b7e9c582538741cd60fb4974cc4e79afad2a36ab2d9692f39b/sockfilter-1.2.tar.gz" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "cba3ee17ef9a2345dbaa523653350f75", "sha256": "0184eb3797edb1a81e6c5560286aad26eb46a9dd0c8ee29d5b249ee68bf36beb" }, "downloads": -1, "filename": "sockfilter-1.3.tar.gz", "has_sig": false, "md5_digest": "cba3ee17ef9a2345dbaa523653350f75", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5494, "upload_time": "2014-07-08T22:26:17", "url": "https://files.pythonhosted.org/packages/a1/80/704d97d73b7373cd0cc16951ce930d7145a80e75f34ade4f2870fd530ab8/sockfilter-1.3.tar.gz" } ], "1.4": [ { "comment_text": "", "digests": { "md5": "414cfc42f8779c4ca880e64b97634967", "sha256": "0aef68d7d76a5842d32174a8a20c5e480f91ed015d535a57d2192b12e152b05a" }, "downloads": -1, "filename": "sockfilter-1.4.tar.gz", "has_sig": false, "md5_digest": "414cfc42f8779c4ca880e64b97634967", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5490, "upload_time": "2014-07-08T22:29:36", "url": "https://files.pythonhosted.org/packages/0f/99/e6a1f75d6d6069c96cbedffb23b11f673492c3b4daebf2367aa52bc79b5e/sockfilter-1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "414cfc42f8779c4ca880e64b97634967", "sha256": "0aef68d7d76a5842d32174a8a20c5e480f91ed015d535a57d2192b12e152b05a" }, "downloads": -1, "filename": "sockfilter-1.4.tar.gz", "has_sig": false, "md5_digest": "414cfc42f8779c4ca880e64b97634967", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5490, "upload_time": "2014-07-08T22:29:36", "url": "https://files.pythonhosted.org/packages/0f/99/e6a1f75d6d6069c96cbedffb23b11f673492c3b4daebf2367aa52bc79b5e/sockfilter-1.4.tar.gz" } ] }