{"id":20036318,"url":"https://github.com/lorien/test_server","last_synced_at":"2025-05-05T05:31:50.778Z","repository":{"id":27431072,"uuid":"30908911","full_name":"lorien/test_server","owner":"lorien","description":"Server to test HTTP clients","archived":false,"fork":false,"pushed_at":"2024-03-16T21:16:06.000Z","size":294,"stargazers_count":4,"open_issues_count":3,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T18:38:48.936Z","etag":null,"topics":["http-server","mock-server","test","testing","testing-tools"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lorien.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-02-17T08:40:25.000Z","updated_at":"2024-10-15T07:40:13.000Z","dependencies_parsed_at":"2024-03-17T00:21:11.734Z","dependency_job_id":null,"html_url":"https://github.com/lorien/test_server","commit_stats":{"total_commits":205,"total_committers":5,"mean_commits":41.0,"dds":0.3219512195121951,"last_synced_commit":"a06884e3137d8183411729cfbf34f3e0cdd02e4c"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorien%2Ftest_server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorien%2Ftest_server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorien%2Ftest_server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorien%2Ftest_server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lorien","download_url":"https://codeload.github.com/lorien/test_server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252446442,"owners_count":21749235,"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":["http-server","mock-server","test","testing","testing-tools"],"created_at":"2024-11-13T10:11:55.387Z","updated_at":"2025-05-05T05:31:49.921Z","avatar_url":"https://github.com/lorien.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Documentation for test_server package\n\n[![Test Status](https://github.com/lorien/test_server/actions/workflows/test.yml/badge.svg)](https://github.com/lorien/test_server/actions/workflows/test.yml)\n[![Code Quality](https://github.com/lorien/test_server/actions/workflows/check.yml/badge.svg)](https://github.com/lorien/test_server/actions/workflows/test.yml)\n[![Type Check](https://github.com/lorien/test_server/actions/workflows/mypy.yml/badge.svg)](https://github.com/lorien/test_server/actions/workflows/mypy.yml)\n[![Test Coverage Status](https://coveralls.io/repos/github/lorien/test_server/badge.svg)](https://coveralls.io/github/lorien/test_server)\n[![Documentation Status](https://readthedocs.org/projects/test_server/badge/?version=latest)](http://user-agent.readthedocs.org)\n\nSimple HTTP Server for testing HTTP clients.\n\n\n## Installation\n\nRun `pip install -U test_server`\n\n\n## Usage Example\n\n```python\nfrom unittest import TestCase\nimport unittest\nfrom urllib.request import urlopen\n\nfrom test_server import TestServer, Response, HttpHeaderStorage\n\n\nclass UrllibTestCase(TestCase):\n   @classmethod\n   def setUpClass(cls):\n       cls.server = TestServer()\n       cls.server.start()\n\n   @classmethod\n   def tearDownClass(cls):\n       cls.server.stop()\n\n   def setUp(self):\n       self.server.reset()\n\n   def test_get(self):\n       self.server.add_response(\n           Response(\n               data=b\"hello\",\n               headers={\"foo\": \"bar\"},\n           )\n       )\n       self.server.add_response(Response(data=b\"zzz\"))\n       url = self.server.get_url()\n       info = urlopen(url)\n       self.assertEqual(b\"hello\", info.read())\n       self.assertEqual(\"bar\", info.headers[\"foo\"])\n       info = urlopen(url)\n       self.assertEqual(b\"zzz\", info.read())\n       self.assertTrue(\"bar\" not in info.headers)\n\n\n   unittest.main()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Florien%2Ftest_server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Florien%2Ftest_server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Florien%2Ftest_server/lists"}