{ "info": { "author": "Tarek Ziade", "author_email": "tarek@ziade.org", "bugtrack_url": null, "classifiers": [], "description": "========\nSmwogger\n========\n\n.. image:: http://coveralls.io/repos/github/tarekziade/smwogger/badge.svg?branch=master\n :target: https://coveralls.io/github/tarekziade/smwogger?branch=master\n\n.. image:: http://travis-ci.org/tarekziade/smwogger.svg?branch=master\n :target: https://travis-ci.org/tarekziade/smwogger\n\n\n\n**Smwogger** (pronounced smoger) is a smoke test tool for Swagger.\n\nSmwogger's goal is to provide a quick and simple way to smoke\ntest a service using its Swagger description.\n\n\nTo add a smoke test for you API, you have three options:\n\n1. Add an **x-smoke-test** section in your Swagger spec, describing your\n smoke test scenario.\n2. Have a specific file that contains the **x-smoke-test** section.\n3. Use the API class which binds its methods to Swagger operations in your\n own Python script.\n\n\nExample using x-smoke-test\n==========================\n\nYou can run the test by pointing the Swagger spec URL (or path to a file)::\n\n $ smwogger smwogger/tests/shavar.yaml\n ..................\n\n\nYou can display the sequence that's being executed with **-v**::\n\n $ smwogger -v smwogger/tests/shavar.yaml\n Scanning spec... OK\n\n This is project 'Shavar Service'\n Mozilla's implementation of the Safe Browsing protocol\n Version 0.7.0\n\n\n Running Scenario\n 1:getHeartbeat... OK\n 2:getDownloads... OK\n 3:getDownloads... OK\n\nIf you need to get more details about the requests and responses sent, you can\nincrease verbosity with the **-vv** option::\n\n $ smwogger -vv smwogger/tests/shavar.yaml\n Scanning spec... OK\n\n This is project 'Shavar Service'\n Mozilla's implementation of the Safe Browsing protocol\n Version 0.7.0\n\n\n Running Scenario\n 1:getHeartbeat...\n GET https://shavar.somwehere.com/__heartbeat__\n >>>\n HTTP/1.1 200 OK\n Content-Type: text/plain; charset=UTF-8\n Date: Mon, 21 Nov 2016 14:03:19 GMT\n Content-Length: 2\n Connection: keep-alive\n\n OK\n <<<\n OK\n 2:getDownloads...\n POST https://shavar.somwehere.com/downloads\n Content-Length: 30\n\n moztestpub-track-digest256;a:1\n\n >>>\n HTTP/1.1 200 OK\n Content-Type: application/octet-stream\n Date: Mon, 21 Nov 2016 14:03:23 GMT\n Content-Length: 118\n Connection: keep-alive\n\n n:3600\n i:moztestpub-track-digest256\n ad:1\n u:tracking-protection.somwehere.com/moztestpub-track-digest256/1469223014\n\n <<<\n OK\n 3:getDownloads...\n POST https://shavar.somwehere.com/downloads\n Content-Length: 35\n\n moztestpub-trackwhite-digest256;a:1\n\n >>>\n HTTP/1.1 200 OK\n Content-Type: application/octet-stream\n Date: Mon, 21 Nov 2016 14:03:23 GMT\n Content-Length: 128\n Connection: keep-alive\n\n n:3600\n i:moztestpub-trackwhite-digest256\n ad:1\n u:tracking-protection.somwehere.com/moztestpub-trackwhite-digest256/1469551567\n\n <<<\n OK\n\n\nDescribing your scenario\n========================\n\nA scenario is described by providing a sequence of operations to\nperform, given their **operationId**.\n\nFor each operation, you can make some assertions on the\n**response** by providing values for the status code and some\nheaders.\n\nExample in YAML ::\n\n x-smoke-test:\n scenario:\n - getSomething:\n request:\n params:\n foo: bar\n response:\n status: 200\n headers:\n Content-Type: application/json\n - getSomethingElse\n response:\n status: 200\n - getSomething\n response:\n status: 200\n\nIf a response does not match, an assertion error will be raised.\n\n\nPosting data\n============\n\nWhen you are posting data, you can provide the request body content in the\noperation under the **request** key.\n\nExample in YAML ::\n\n x-smoke-test:\n scenario:\n - postSomething:\n request:\n body: This is the body I am sending.\n response:\n status: 200\n\n\nReplacing Path variables\n========================\n\nIf some of your paths are using template variables, as defined by the swagger\nspec, you can use the **path** option::\n\n\n x-smoke-test:\n scenario:\n - postSomething:\n request:\n body: This is the body I am sending.\n path:\n var1: ok\n var2: blah\n response:\n status: 200\n\nYou can also define global path values that will be looked up when formatting\npaths. In that case, variables have to be defined in a top-level **path**\nsection::\n\n x-smoke-test:\n path:\n var1: ok\n scenario:\n - postSomething:\n request:\n body: This is the body I am sending.\n path:\n var2: blah\n response:\n status: 200\n\n\nVariables\n=========\n\nYou can extract values from responses, in order to reuse them in\nsubsequential operations, wether it's to replace variables in\npath templates, or create a body.\n\nFor example, if **getSomething** returns a JSON dict with a \"foo\" value,\nyou can extract it by declaring it in a **vars** section inside the\n**response** key::\n\n x-smoke-test:\n path:\n var1: ok\n scenario:\n - getSomething:\n request:\n body: This is the body I am sending.\n path:\n var2: blah\n response:\n status: 200\n vars:\n foo:\n query: foo\n default: baz\n\nSmwogger will use the **query** value to know where to look in the response\nbody and extract the value. If the value is not found and **default** is\nprovided, the variable will take that value.\n\nOnce the variable is set, it will be reused by Smwogger for subsequent\noperations, to replace variables in path templates, or to fill response data.\n\nThe path formatting is done automatically. Smwogger will look first at\nvariables defined in operations, then at the path sections.\n\nIf you want to use a variable in a body, you need to use the ${formatting}::\n\n x-smoke-test:\n path:\n var1: ok\n scenario:\n - getSomething:\n response:\n vars:\n foo:\n query: foo\n default: baz\n - doSomething:\n request:\n body: ${foo}\n\n\nUsing the API\n=============\n\n\nIf your scenario is too complex for fitting in the description,\nyou can use a plain Python script in the --test option.\n\nA Python script test is a module with a **scenario** function.\nThe function will be executed and will get an instance of the API\nclass and the arguments passed to the smwogger client.\n\nThe function needs to be a coroutine. Example::\n\n from smwogger.cli import console\n\n async def scenario(api, args):\n with console('Getting something', verbose=args.verbose):\n resp = await api.getSomething()\n assert resp.status == 200\n\n\nYou can also use a plain Python script if you want to handle\neverything by yourself.\n\nIn the example below, the script prints out all the operation ids\npublished::\n\n import asyncio\n from smwogger import API\n\n\n async def print_operations():\n async with API('http://petstore.swagger.io/v2/swagger.json') as api:\n print(api.operations)\n\n\n loop = asyncio.get_event_loop()\n try:\n loop.run_until_complete(print_operations())\n finally:\n loop.close()\n\n\n\nContributors\n============\n\nProject created by Tarek Ziade \n\nContributors in order of appearance:\n\n* Lucas Cimon \n\n\n\nReleases\n========\n\n1.0 2017-03-28\n--------------\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/tarekziade/smwogger", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "smwogger", "package_url": "https://pypi.org/project/smwogger/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/smwogger/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/tarekziade/smwogger" }, "release_url": "https://pypi.org/project/smwogger/1.0/", "requires_dist": null, "requires_python": null, "summary": "Smoke Test tool", "version": "1.0" }, "last_serial": 2735609, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "6c913cfd66349d34db0b9505ed918b82", "sha256": "15ad0ed73014edc1d3af2fc6c59de7d49829a040509b1d46329307ddc845f1f9" }, "downloads": -1, "filename": "smwogger-1.0.tar.gz", "has_sig": false, "md5_digest": "6c913cfd66349d34db0b9505ed918b82", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13647, "upload_time": "2017-03-28T09:21:32", "url": "https://files.pythonhosted.org/packages/f0/96/95e28e13be08ad328bfbf2301a0e81cdd30110ffeeb6ade3d6873487aee5/smwogger-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6c913cfd66349d34db0b9505ed918b82", "sha256": "15ad0ed73014edc1d3af2fc6c59de7d49829a040509b1d46329307ddc845f1f9" }, "downloads": -1, "filename": "smwogger-1.0.tar.gz", "has_sig": false, "md5_digest": "6c913cfd66349d34db0b9505ed918b82", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13647, "upload_time": "2017-03-28T09:21:32", "url": "https://files.pythonhosted.org/packages/f0/96/95e28e13be08ad328bfbf2301a0e81cdd30110ffeeb6ade3d6873487aee5/smwogger-1.0.tar.gz" } ] }