{"id":17044780,"url":"https://github.com/keredson/boddle","last_synced_at":"2025-04-12T15:20:51.784Z","repository":{"id":57415857,"uuid":"77061826","full_name":"keredson/boddle","owner":"keredson","description":"Unit testing tool for Python's bottle library.","archived":false,"fork":false,"pushed_at":"2020-08-11T18:43:02.000Z","size":24,"stargazers_count":46,"open_issues_count":10,"forks_count":10,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-26T09:51:11.518Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/keredson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-21T15:09:20.000Z","updated_at":"2024-10-30T17:16:02.000Z","dependencies_parsed_at":"2022-09-16T08:50:39.083Z","dependency_job_id":null,"html_url":"https://github.com/keredson/boddle","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keredson%2Fboddle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keredson%2Fboddle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keredson%2Fboddle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keredson%2Fboddle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keredson","download_url":"https://codeload.github.com/keredson/boddle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248586217,"owners_count":21128998,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T09:35:29.388Z","updated_at":"2025-04-12T15:20:51.754Z","avatar_url":"https://github.com/keredson.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![image](https://cloud.githubusercontent.com/assets/2049665/21398745/27452db6-c76e-11e6-8605-8e5f3301472b.png)\n\n# Boddle\nA unit testing tool for Python's bottle library.  We wrote this for our own testing purposes at https://www.hvst.com.  Thanks [brenguyen711](https://github.com/brenguyen711) for the great name!\n\n## Install\n```\nsudo pip install boddle\n```\n\n## Usage\nAssuming you have a bottle route like this:\n\n```python\n@bottle.get('/woot')\ndef woot():\n  return bottle.request.params['name']\n```\n\nYou can unit test it like:\n\n```python\nimport unittest\nfrom boddle import boddle\n\nclass TestIt(unittest.TestCase):\n  def testWoot(self):\n    with boddle(params={'name':'derek'}):\n      self.assertEqual(woot(), 'derek')\n```\nSee [`example.py`](example.py).\n\n### Options\n\nThe Bottle-specific params that are supported are:\n\n| Argument | Notes |\n|----------|-------|\n| `params` | Populates `request.params`.  Takes a `dict` or list of pairs.  Useful for both POST and GET params. |\n| `path` | The path component of the url.  Populates `request.path`, which always has a preceeding `/`. |\n| `method` | POST, GET, etc.  Bottle will uppercase the value. |\n| `headers` | Any HTTP headers.  Takes a `dict`. |\n| `json` | Takes anything that can be consumed by `json.dumps()`.  Also sets the content type of the request. |\n| `url` | The full URL, protocol, domain, port, path, etc.  Will be parsed until its `urlparts` before populating `request.url`. |\n| `body` | The raw body of the request.  Takes either a `str` or a file-like object.  `str`s will be converted into file-like objects.  Populated `request.body`. |\n| `query` | Populates `request.query`.  Takes a `dict`.  |\n\nAll other keyword arguments will be assigned to the request object.  For instance, we often do:\n```python\nwith boddle(current_user=someone):\n  # code that accesses bottle.request.current_user\n```\n\nYou can also nest `boddle` calls.  For instance:\n```python\nwith boddle(path='/woot'):\n  with boddle(params={'name':'derek'}):\n    # both path and params are set here\n  # only path is set here\n```\n\n**ALL CHANGES TO `bottle.request` ARE REVERTED WHEN THE WITH BLOCK ENDS.**\n\n\n## Testing\n\n![image](https://api.travis-ci.org/keredson/boddle.svg?branch=master)\n\n```\n$ git clone https://github.com/keredson/boddle.git\n$ cd boddle\n$ python tests.py \n............\n----------------------------------------------------------------------\nRan 12 tests in 0.001s\n\nOK\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeredson%2Fboddle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeredson%2Fboddle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeredson%2Fboddle/lists"}