{ "info": { "author": "Marcos Cardoso", "author_email": "vrcmarcos@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# ElasticMock\n\nPython Elasticsearch Mock for test purposes\n\n[![Build Status](https://travis-ci.org/vrcmarcos/elasticmock.svg?branch=master)](https://travis-ci.org/vrcmarcos/elasticmock) [![Coverage Status](https://coveralls.io/repos/github/vrcmarcos/elasticmock/badge.svg?branch=master)](https://coveralls.io/github/vrcmarcos/elasticmock?branch=master) [![PyPI version](https://badge.fury.io/py/ElasticMock.svg)](https://badge.fury.io/py/ElasticMock) [![Code Health](https://landscape.io/github/vrcmarcos/elasticmock/master/landscape.svg?style=flat)](https://landscape.io/github/vrcmarcos/elasticmock/master) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/vrcmarcos/elasticmock/master/LICENSE)\n\n## Installation\n\n```shell\npip install ElasticMock\n```\n\n## Usage\n\nTo use ElasticMock, decorate your test method with **@elasticmock** decorator:\n\n```python\nfrom unittest import TestCase\n\nfrom elasticmock import elasticmock\n\n\nclass TestClass(TestCase):\n\n @elasticmock\n def test_should_return_something_from_elasticsearch(self):\n self.assertIsNotNone(some_function_that_uses_elasticsearch())\n```\n\n## Notes:\n\n- The mocked **search** method returns **all available documents** indexed on the index with the requested document type.\n- The mocked **suggest** method returns the exactly suggestions dictionary passed as body serialized in Elasticsearch.suggest response. **Atention:** If the term is an *int*, the suggestion will be ```python term + 1```. If not, the suggestion will be formatted as ```python {0}_suggestion.format(term) ```.\nExample:\n\t- **Suggestion Body**:\n\t```python\n suggestion_body = {\n 'suggestion-string': {\n 'text': 'test_text',\n 'term': {\n 'field': 'string'\n }\n },\n 'suggestion-id': {\n 'text': 1234567,\n 'term': {\n 'field': 'id'\n }\n }\n }\n ```\n - **Suggestion Response**:\n ```python\n {\n 'suggestion-string': [\n {\n 'text': 'test_text',\n 'length': 1,\n 'options': [\n {\n 'text': 'test_text_suggestion',\n 'freq': 1,\n 'score': 1.0\n }\n ],\n 'offset': 0\n }\n ],\n 'suggestion-id': [\n {\n 'text': 1234567,\n 'length': 1,\n 'options': [\n {\n 'text': 1234568,\n 'freq': 1,\n 'score': 1.0\n }\n ],\n 'offset': 0\n }\n ],\n }\n ```\n\n## Testing\n\n```bash\npython setup.py test\n```\n\n## Changelog\n\n#### 1.3.6\n\n- [Fix installation issue](https://github.com/vrcmarcos/elasticmock/pull/20) (Thanks [@tdhopper](https://github.com/tdhopper))\n\n#### 1.3.5\n\n- [Fix 1.3.4 release](https://github.com/vrcmarcos/elasticmock/pull/19) (Thanks [@infinite-Joy](https://github.com/infinite-Joy))\n\n#### 1.3.4\n\n- [Added aggregations to response if requested](https://github.com/vrcmarcos/elasticmock/pull/15) (Thanks [@snakeye](https://github.com/snakeye))\n- [Implementing new methods for scrolling](https://github.com/vrcmarcos/elasticmock/pull/17) (Thanks [@tcatrain](https://github.com/tcatrain))\n\n#### 1.3.3\n\n- [Search: doc_type can be a list](https://github.com/vrcmarcos/elasticmock/pull/16) (Thanks [@garncarz](https://github.com/garncarz))\n- [Exclude tests package](https://github.com/vrcmarcos/elasticmock/pull/13) (Thanks [@jmlw](https://github.com/jmlw))\n- [Make the FakeElasticsearch __init__ signature match the one from Elasticsearc]((https://github.com/vrcmarcos/elasticmock/pull/10) (Thanks [@xrmx](https://github.com/xrmx))\n- [Improve search and count](https://github.com/vrcmarcos/elasticmock/pull/7) (Thanks [@frivoire](https://github.com/frivoire))\n\n#### 1.3.2\n\n- **elasticmock**: Python 3 fixes (Thanks [@barseghyanartur](https://github.com/barseghyanartur))\n- **test**: Add information on testing (Thanks [@barseghyanartur](https://github.com/barseghyanartur))\n- **README.md**: Fixed typo (Thanks [@bowlofstew](https://github.com/bowlofstew))\n\n#### 1.3.1\n\n- **elasticmock**: Allow the same arguments to the mock that elasticsearch.Elasticsearch allows (Thanks [@mattbreeden](https://github.com/mattbreeden))\n\n#### 1.3.0:\n- **FakeElasticSearch**: Mocked **count** method (Thanks [@TheoResources](https://github.com/TheoResources))\n\n#### 1.2.0:\n- **FakeElasticSearch**: Mocked **suggest** method\n\n#### 1.1.1:\n- **elasticmock**: Changing the cleanup older FakeElasticSearch's instances order\n- **FakeElasticSearch.index**: Changing the method signature to correctly overrides the Elasticsearch.index method\n\n#### 1.1.0:\n- **FakeElasticSearch**: Mocked **delete** method\n\n#### 1.0.1:\n- **setup.py**: Fixed GitHub link\n\n#### 1.0.0:\n- **elasticmock**: Created **@elasticmock** decorator\n- **FakeElasticSearch**: Mocked **exists**, **get**, **get_source**, **index**, **info**, **search** and **ping** method", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/vrcmarcos/elasticmock", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "ElasticMock", "package_url": "https://pypi.org/project/ElasticMock/", "platform": "", "project_url": "https://pypi.org/project/ElasticMock/", "project_urls": { "Homepage": "https://github.com/vrcmarcos/elasticmock" }, "release_url": "https://pypi.org/project/ElasticMock/1.3.6/", "requires_dist": null, "requires_python": "", "summary": "Python Elasticsearch Mock for test purposes", "version": "1.3.6" }, "last_serial": 4941935, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "d6e6c1c9859e0280434be483c2fc15aa", "sha256": "210d5f85d2c6738e74d6aa00f047e2db54696baeeac4a5c3bc1fe504371472cb" }, "downloads": -1, "filename": "ElasticMock-1.0.0.tar.gz", "has_sig": false, "md5_digest": "d6e6c1c9859e0280434be483c2fc15aa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3957, "upload_time": "2016-08-10T17:03:52", "url": "https://files.pythonhosted.org/packages/da/ac/4fdc7b6999ca91ef3c715ce4dd23abb0a67eb0b6c661d8de409fe5a8f232/ElasticMock-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "6dca8c6b6c60af84f7bbf54e8da97c90", "sha256": "7b4597ea1e04a447e9a2b7fd933800c9ad3556b4871b9d02757a8c92dc973072" }, "downloads": -1, "filename": "ElasticMock-1.0.1.tar.gz", "has_sig": false, "md5_digest": "6dca8c6b6c60af84f7bbf54e8da97c90", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3964, "upload_time": "2016-08-10T17:08:00", "url": "https://files.pythonhosted.org/packages/93/6f/9177723c43d047ec96753412d58769799031a37642bea9a4a254868b015b/ElasticMock-1.0.1.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "c731d482a3e4fe42bc2b2a5232728b21", "sha256": "34a1e6ecd46ac596e77b68723cd20a4918c863b2e90f27b8b1dfb6601af42ddf" }, "downloads": -1, "filename": "ElasticMock-1.1.0.tar.gz", "has_sig": false, "md5_digest": "c731d482a3e4fe42bc2b2a5232728b21", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4194, "upload_time": "2016-08-11T22:38:42", "url": "https://files.pythonhosted.org/packages/4c/2f/dd1c8282187fd342b90d8526884302d223a1226a9003ee689f48f91b0106/ElasticMock-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "0794c2bb2e482ea7ec2cc55c0482ea99", "sha256": "96a1777d363d4ef36583c4d81f4af65de337f83ed49d022375aa4ce100050709" }, "downloads": -1, "filename": "ElasticMock-1.1.1.tar.gz", "has_sig": false, "md5_digest": "0794c2bb2e482ea7ec2cc55c0482ea99", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4161, "upload_time": "2016-08-12T00:10:36", "url": "https://files.pythonhosted.org/packages/e3/80/41e9d1050a4be258c4de899f06901a133ced55e1b22b95b0dee93cf2fe66/ElasticMock-1.1.1.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "3cb537865e829b646b1994ce8bdd94d4", "sha256": "133a94759af5ad4e175a16eca0c8ad720df5a1f354ecf63c6913df88d85159a4" }, "downloads": -1, "filename": "ElasticMock-1.2.0.tar.gz", "has_sig": false, "md5_digest": "3cb537865e829b646b1994ce8bdd94d4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4520, "upload_time": "2016-08-12T18:32:36", "url": "https://files.pythonhosted.org/packages/34/10/ba8f22f7322cb24fdbe2bfcde0dc3b13ee15ce42c8678c8dec15251a40e2/ElasticMock-1.2.0.tar.gz" } ], "1.3.0": [ { "comment_text": "", "digests": { "md5": "1400e1d3d57f72d843b9e842fcea99e5", "sha256": "263e4931778435d2ef4b68b1111860a8cbdf0ae004cf1c3c1daaae5d43b69119" }, "downloads": -1, "filename": "ElasticMock-1.3.0.tar.gz", "has_sig": false, "md5_digest": "1400e1d3d57f72d843b9e842fcea99e5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4587, "upload_time": "2017-04-11T18:23:45", "url": "https://files.pythonhosted.org/packages/78/4a/f9279acb6cf3aa418c89202cd8d1fb3fbf5f3f38e3967fb9f277a8effa6c/ElasticMock-1.3.0.tar.gz" } ], "1.3.1": [ { "comment_text": "", "digests": { "md5": "90a90177d81e182589e2cc32a6c7d0c8", "sha256": "e64c5a5e6b3fc974b5a5c62f5fd30f3f4f335f04cfb3a436d8bf1e9f84605d41" }, "downloads": -1, "filename": "ElasticMock-1.3.1.tar.gz", "has_sig": false, "md5_digest": "90a90177d81e182589e2cc32a6c7d0c8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4566, "upload_time": "2017-05-07T18:29:03", "url": "https://files.pythonhosted.org/packages/40/e2/b2cd288da495e601f9cf92bce4027e11bdf2759df2aced4a91fa22fcc433/ElasticMock-1.3.1.tar.gz" } ], "1.3.2": [ { "comment_text": "", "digests": { "md5": "cd442806b282584a0ada4629c184b9d1", "sha256": "2fbecaa876d07669517ee3b8e26d3f769d1c561d27443af0765ca045f554c113" }, "downloads": -1, "filename": "ElasticMock-1.3.2.tar.gz", "has_sig": false, "md5_digest": "cd442806b282584a0ada4629c184b9d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4617, "upload_time": "2017-06-13T01:11:15", "url": "https://files.pythonhosted.org/packages/f5/6f/983ad5ed0bc68d9475e1c8ff6850d4fef2f04ba5366b41e5e0fc94956ed8/ElasticMock-1.3.2.tar.gz" } ], "1.3.3": [ { "comment_text": "", "digests": { "md5": "929aa8a2aab104621f18f37381a22ef0", "sha256": "dbcc00b82f26da18bed609ea35a63d359cfc71744d69640fc9534736f3d3cd73" }, "downloads": -1, "filename": "ElasticMock-1.3.3-py3-none-any.whl", "has_sig": false, "md5_digest": "929aa8a2aab104621f18f37381a22ef0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8490, "upload_time": "2018-10-03T20:25:57", "url": "https://files.pythonhosted.org/packages/a3/db/98d5cb6756295cf32f7659da7d1ed84add475c66af986075c0611c69e6c1/ElasticMock-1.3.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "60149528fcb3e41fca1dddf981527ace", "sha256": "2dc5f96023556b4be71c00788f14890e94b69d0f1c6323ba4b018e2c5a836ecd" }, "downloads": -1, "filename": "ElasticMock-1.3.3.tar.gz", "has_sig": false, "md5_digest": "60149528fcb3e41fca1dddf981527ace", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6618, "upload_time": "2018-10-03T20:25:59", "url": "https://files.pythonhosted.org/packages/4e/e4/3e5f75e652d2bc8b79c778cb5f139bec1fd4c6ea8d169b5016283334b332/ElasticMock-1.3.3.tar.gz" } ], "1.3.4": [ { "comment_text": "", "digests": { "md5": "0e34539c40de6ffa91eeb67d4f2e0372", "sha256": "157a1cdf1f75ee580165826f1f5c8f371f7acef4c00f567feffe0a612b1baea2" }, "downloads": -1, "filename": "ElasticMock-1.3.4-py2-none-any.whl", "has_sig": false, "md5_digest": "0e34539c40de6ffa91eeb67d4f2e0372", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 10923, "upload_time": "2019-03-04T02:11:41", "url": "https://files.pythonhosted.org/packages/e6/c2/81019e733617623ec8bca1ed19d0785ac14c6146d3e9eb30694208c331c5/ElasticMock-1.3.4-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "77ae777dfc9de068b8d66104b47ddd65", "sha256": "079b05aaf4f794486ffcd44876f525d1882f2930493c0b29bc26836c941ea9a7" }, "downloads": -1, "filename": "ElasticMock-1.3.4.tar.gz", "has_sig": false, "md5_digest": "77ae777dfc9de068b8d66104b47ddd65", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7193, "upload_time": "2019-03-04T02:11:42", "url": "https://files.pythonhosted.org/packages/ea/9d/0356977f69410f30d13653498ac0728c31b75b82ae665d287f56b53207d8/ElasticMock-1.3.4.tar.gz" } ], "1.3.5": [ { "comment_text": "", "digests": { "md5": "62d4ac0e66c5fdcdcf02ca0107351ce1", "sha256": "ef41fbce5054ea741224383e8c3d04509950cf1ebb1c4911357e7b1ca49704b3" }, "downloads": -1, "filename": "ElasticMock-1.3.5.tar.gz", "has_sig": false, "md5_digest": "62d4ac0e66c5fdcdcf02ca0107351ce1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7314, "upload_time": "2019-03-06T19:06:56", "url": "https://files.pythonhosted.org/packages/ee/27/d70e1ca53b8080138f613e4d600831397acd6bf7fdc466bea32692fc9bf5/ElasticMock-1.3.5.tar.gz" } ], "1.3.6": [ { "comment_text": "", "digests": { "md5": "18022d4e857c47dcca32cda6e1787f2e", "sha256": "19ca24606fea9581eb667a5777fc3f42b58f5d80778a61bc370f417ffd4de86f" }, "downloads": -1, "filename": "ElasticMock-1.3.6.tar.gz", "has_sig": false, "md5_digest": "18022d4e857c47dcca32cda6e1787f2e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7667, "upload_time": "2019-03-14T22:33:24", "url": "https://files.pythonhosted.org/packages/fe/47/c6e44643aced3b9635f58e687dc998e94a0b7d093351dea2cbe26c7feb70/ElasticMock-1.3.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "18022d4e857c47dcca32cda6e1787f2e", "sha256": "19ca24606fea9581eb667a5777fc3f42b58f5d80778a61bc370f417ffd4de86f" }, "downloads": -1, "filename": "ElasticMock-1.3.6.tar.gz", "has_sig": false, "md5_digest": "18022d4e857c47dcca32cda6e1787f2e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7667, "upload_time": "2019-03-14T22:33:24", "url": "https://files.pythonhosted.org/packages/fe/47/c6e44643aced3b9635f58e687dc998e94a0b7d093351dea2cbe26c7feb70/ElasticMock-1.3.6.tar.gz" } ] }