{ "info": { "author": "Simon Weber", "author_email": "simon@venmo.com", "bugtrack_url": null, "classifiers": [], "description": "btnamespace\n===========\n\n.. image:: https://travis-ci.org/venmo/btnamespace.svg?branch=master\n :target: https://travis-ci.org/venmo/btnamespace\n\nA Braintree namespace isolates state on the Braintree gateway:\n\n.. code-block:: python\n\n import braintree\n import btnamespace\n\n with btnamespace.Namespace():\n customer = braintree.Customer.create({\"id\": \"123\"})\n assert customer.id == \"123\"\n braintree.Customer.find(\"123\") # success\n\n braintree.Customer.find(\"123\") # NotFound exception\n\nThis is primarily useful during integration tests:\n\n.. code-block:: python\n\n def setUp(self):\n self.namespace = btnamespace.Namespace()\n self.namespace.__enter__()\n\n def test_some_sandbox_integration(self):\n #...\n\n def tearDown(self):\n self.namespace.__exit__()\n\n\nCompared to calling eg ``braintree.Customer.delete`` during ``tearDown``, this has a number of advantages:\n\n- it's faster, since no teardown is needed\n- it's simpler, since it doesn't require any bookkeeping\n- it's robust, since tests can be written without any state assumptions\n\nYou can install it with ``$ pip install btnamespace``.\n\n\nWhat's supported\n----------------\n\n- Customer create, update, find, delete\n- CreditCard create, update, find, delete\n- Transaction create, find\n\nAll operations involving subresources - eg creating a CreditCard and Customer in one call - work as expected.\n\nAdding support for other operations is easy; we just haven't needed them yet.\nContributions welcome!\n\n\nHow it Works\n------------\n\nUnder the hood, a Namespace globally patches the braintree client library.\n\nDuring create operations, any provided ids are removed.\nThis forces the gateway to respond with unique ids, which are later mapped back to the originally-provided ids.\nHere's an example:\n\n- on a call to ``braintree.Customer.create({'id': '123', ...})``, ``'123'`` is stored as a Customer id and the call becomes ``braintree.Customer.create({...})``.\n- then, the server returns a unique id ``'abcde'`` for the Customer. ``'123'`` is mapped to ``'abcde'``, and the resulting Customer object's id is set to ``'123'``.\n- later, a call to ``braintree.Customer.find('123')`` becomes ``braintree.Customer.find('abcde')``.\n\n\nContributing\n------------\n\nInside your vitualenv:\n\n.. code-block:: bash\n\n $ cd btnamespace\n $ pip install -e .\n $ pip install -r requirements.txt\n\n\nTo run the tests, first add your sandbox credentials:\n\n.. code-block:: bash\n\n $ export BT_MERCHANT_ID=merchant-id\n $ export BT_PUBLIC_KEY=public-id\n $ export BT_PRIVATE_KEY=private-key\n\n\nThen run ``$ python tests/test_integration.py``.\n\n\nHistory\n-------\n2.0.0\n+++++\nreleased 2016-07-15\n\n- breaking: drop python 2.6 support\n- fix a bug affecting operations after exiting a namespace\n- add strict_missing and strict_missing_exception options\n\n\n1.1.1\n+++++\nreleased 2014-09-26\n\n- pin bidict to 0.1.5 to avoid breaking changes in newer versions\n\n1.1.0\n+++++\nreleased 2014-07-28\n\n- add schema for braintree.ClientToken.generate\n\n1.0.1\n+++++\nreleased 2014-04-08\n\n- use less expensive introspection\n- remove decorator dependency\n\n1.0.0\n+++++\nreleased 2014-04-07\n\n- initial release", "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/venmo/btnamespace", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "btnamespace", "package_url": "https://pypi.org/project/btnamespace/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/btnamespace/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/venmo/btnamespace" }, "release_url": "https://pypi.org/project/btnamespace/2.0.0/", "requires_dist": null, "requires_python": null, "summary": "Isolate state on the Braintree sandbox during testing.", "version": "2.0.0" }, "last_serial": 2225065, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "6ef3eaa73fe78fa4cda3301e8c062cb7", "sha256": "35143b4d352df7645410b3d4c8450fb00c9201fe1938e6082fb00fab5760b1e2" }, "downloads": -1, "filename": "btnamespace-1.0.0.tar.gz", "has_sig": false, "md5_digest": "6ef3eaa73fe78fa4cda3301e8c062cb7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8338, "upload_time": "2014-04-07T21:00:09", "url": "https://files.pythonhosted.org/packages/80/88/deb723dbff08dde220b6b46dbe6eb29c8f3e0c9299c3ec24bac08f5343e3/btnamespace-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "c9291b55f1310d4b935fe22ef9c85a0c", "sha256": "b3058c5c3769aabddb0511bc77e61906aeee3b6ff07acc6f3cdc34a77fe564a1" }, "downloads": -1, "filename": "btnamespace-1.0.1.tar.gz", "has_sig": false, "md5_digest": "c9291b55f1310d4b935fe22ef9c85a0c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9045, "upload_time": "2014-04-08T15:26:34", "url": "https://files.pythonhosted.org/packages/b4/19/ab708d95d267cee92b01234ae08d977134ff211562e8e70476b74a367949/btnamespace-1.0.1.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "3556ca25765dcb65c5f5dcee5e962ab4", "sha256": "2f115a3e3944c99ec0c5244597d4b48d07b48b89a5327597c2494da1d86e9d95" }, "downloads": -1, "filename": "btnamespace-1.1.0.tar.gz", "has_sig": false, "md5_digest": "3556ca25765dcb65c5f5dcee5e962ab4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10394, "upload_time": "2014-07-28T23:08:08", "url": "https://files.pythonhosted.org/packages/0f/16/ef960abc02aa6b40a01aba763795c527d5ee5086e4b66cdf73255a2d0593/btnamespace-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "77255b1ef48c70524619497a86a14066", "sha256": "320a0c378fa02ee6e8fcf69e25b13cf9d0517e28e96cc19452c5ff654cccb2ce" }, "downloads": -1, "filename": "btnamespace-1.1.1.tar.gz", "has_sig": false, "md5_digest": "77255b1ef48c70524619497a86a14066", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9124, "upload_time": "2014-09-26T19:40:37", "url": "https://files.pythonhosted.org/packages/bd/19/daf026615159a206ccef0102b2794d89893b0b134c91e386f8c8e26ea54a/btnamespace-1.1.1.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "a0b807afed4a4756e8ff9f021af62e49", "sha256": "1ad5404c2c81bae02f72a0223225d7a5cc57092532984efd080129ec067e5880" }, "downloads": -1, "filename": "btnamespace-2.0.0.tar.gz", "has_sig": false, "md5_digest": "a0b807afed4a4756e8ff9f021af62e49", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9441, "upload_time": "2016-07-15T21:11:58", "url": "https://files.pythonhosted.org/packages/39/26/7b3b1fd8a242b30c32150bba65c6aec79b6366aeef720befb4461609f01e/btnamespace-2.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a0b807afed4a4756e8ff9f021af62e49", "sha256": "1ad5404c2c81bae02f72a0223225d7a5cc57092532984efd080129ec067e5880" }, "downloads": -1, "filename": "btnamespace-2.0.0.tar.gz", "has_sig": false, "md5_digest": "a0b807afed4a4756e8ff9f021af62e49", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9441, "upload_time": "2016-07-15T21:11:58", "url": "https://files.pythonhosted.org/packages/39/26/7b3b1fd8a242b30c32150bba65c6aec79b6366aeef720befb4461609f01e/btnamespace-2.0.0.tar.gz" } ] }