{"id":18684984,"url":"https://github.com/h1alexbel/fakehub","last_synced_at":"2025-04-12T04:32:47.318Z","repository":{"id":241893990,"uuid":"807802459","full_name":"h1alexbel/fakehub","owner":"h1alexbel","description":"GitHub API Server Stub. Fully functional fake version of a GitHub API that supports all the features and works locally, with no connection to GitHub at all.","archived":false,"fork":false,"pushed_at":"2024-11-03T16:17:25.000Z","size":3398,"stargazers_count":5,"open_issues_count":44,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-03T16:20:21.915Z","etag":null,"topics":["github","mock-objects","rust","testing"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/h1alexbel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2024-05-29T19:57:36.000Z","updated_at":"2024-10-16T17:37:28.000Z","dependencies_parsed_at":"2024-10-28T16:33:35.812Z","dependency_job_id":null,"html_url":"https://github.com/h1alexbel/fakehub","commit_stats":null,"previous_names":["h1alexbel/fakehub"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h1alexbel%2Ffakehub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h1alexbel%2Ffakehub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h1alexbel%2Ffakehub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h1alexbel%2Ffakehub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/h1alexbel","download_url":"https://codeload.github.com/h1alexbel/fakehub/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223495110,"owners_count":17154648,"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":["github","mock-objects","rust","testing"],"created_at":"2024-11-07T10:19:56.796Z","updated_at":"2024-11-07T10:19:56.970Z","avatar_url":"https://github.com/h1alexbel.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fakehub\n\n[![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)\n[![DevOps By Rultor.com](http://www.rultor.com/b/h1alexbel/fakehub)](http://www.rultor.com/p/h1alexbel/fakehub)\n[![We recommend IntelliJ IDEA](https://www.elegantobjects.org/intellij-idea.svg)](https://www.jetbrains.com/idea/)\n\n[![just](https://github.com/h1alexbel/fakehub/actions/workflows/just.yml/badge.svg)](https://github.com/h1alexbel/fakehub/actions/workflows/just.yml)\n[![Crates.io Version](https://img.shields.io/crates/v/fakehub)](https://crates.io/crates/fakehub)\n[![codecov](https://codecov.io/gh/h1alexbel/fakehub/graph/badge.svg?token=0bcdqd2UKT)](https://codecov.io/gh/h1alexbel/fakehub)\n[![PDD status](http://www.0pdd.com/svg?name=h1alexbel/fakehub)](http://www.0pdd.com/p?name=h1alexbel/fakehub)\n[![Hits-of-Code](https://hitsofcode.com/github/h1alexbel/fakehub)](https://hitsofcode.com/view/github/h1alexbel/fakehub)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/h1alexbel/fakehub/blob/master/LICENSE.txt)\n[![Known Vulnerabilities](https://snyk.io/test/github/h1alexbel/fakehub/badge.svg)](https://snyk.io/test/github/h1alexbel/fakehub)\n\nfakehub - A fully functional fake version of a [GitHub REST API] that supports all\nthe features and works locally, with no connection to GitHub at all.\n\n**Motivation**. There are many applications that use GitHub API for different\npurposes. All of them need to create automated tests, which need to mock the\nAPI server somehow. We offer a fully functioning mock version of a GitHub REST\nAPI, which would support all functions, but work locally, with absolutely no\nconnection to GitHub.\n\n## Quick start\n\nFirst, install it from [crate][fakehub-crate]:\n\n```bash\ncargo install fakehub\n```\n\nThen, create a simple test, `test.sh`:\n\n```bash\n{\n  fakehub start -d\n  out=\"$(curl -s 'http://localhost:3000/users/jeff' | jq -r '.login')\"\n  expected=\"jeff\"\n  if [ \"$out\" == $expected ]; then\n    echo \"Test passed!\"\n  else\n    echo \"Login '$out' does not match with expected: '$expected'\"\n    exit 1\n  fi\n  fakehub stop\n}\n```\n\nAnd run it:\n\n```bash\nsh test.sh\n```\n\nYou should be able to see this:\n\n```text\n2024-10-15T15:14:33.469924Z  INFO fakehub: Starting server on port 3000\n2024-10-15T15:14:33.470238Z  INFO fakehub: Server is running in detached mode on port 3000\n2024-10-15T15:14:33.470247Z  INFO fakehub_server::sys::sys_info: OS: macos\n2024-10-15T15:14:33.470251Z  INFO fakehub_server::sys::sys_info: PID: 11751\nTest passed!\n2024-10-15T15:14:33.486892Z  INFO fakehub: Stopping fakehub...\n2024-10-15T15:14:33.518901Z  INFO fakehub::sys::kill_unix: Port 3000 killed\n2024-10-15T15:14:33.518913Z  INFO fakehub: fakehub stopped\n```\n\n## Table of contents\n\n* [Overview](#overview)\n* [Request format](#request-format)\n* [GitHub objects](#github-objects)\n* [CLI options](#cli-options)\n\n### Overview\n\nfakehub is a full clone of [GitHub REST API]. This is very beneficial for\ntesting, when you should not use real GitHub, but a mock version of it instead.\nfakehub stores all the data in memory. When [request arrives](#request-format),\nwe query the storage, transform objects into GitHub API-compatible format\n([JSON]) and give it to you.\n\n### Request format\n\nfakehub supports the format specified in [GitHub REST API docs][GitHub REST API].\nFor instance, if you want to use [Get a repository][GitHub REST API Get Repo]\nendpoint: you should just replace `api.github.com` to `localhost:$port` (make\nsure that `fakehub` is running on specified port).\n\n```bash\ncurl -L \\\n  -H \"Accept: application/vnd.github+json\" \\\n  -H \"Authorization: Bearer \u003cYOUR-TOKEN\u003e\" \\\n  -H \"X-GitHub-Api-Version: 2022-11-28\" \\\n  http://localhost:$port/repos/OWNER/REPO\n```\n\n**Attention!** Don't use your own GitHub Personal Access Tokens to authorize in\nfakehub. Instead, use generated token by fakehub:\n\n```bash\ncurl -X POST \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"login\": \"jeff\"}' \\\n  http://localhost:$port/login\n```\n\nThis should generate you an access token to fakehub API.\n\n### GitHub objects\n\nTBD..\n\n### CLI options\n\nYou can use the following options within `fakehub` command-line tool:\n\n| Name              | Value   | Default | Description                                                                                               |\n|-------------------|---------|---------|-----------------------------------------------------------------------------------------------------------|\n| `-p`, `--port`    | int     | `3000`  | Port to run fakehub server on.                                                                            |\n| `-v`, `--verbose` | boolean | `false` | Verbose run output, i.e. debug logs, etc.                                                                 |\n| `-d`,  `--detach` | boolean | `false` | Run fakehub server in detached mode.                                                                      |\n| `-i`, `--init`    | string  | -       | Path to file or directory with initial state.                                                             |\n| `-r`, `--report`  | boolean | `false` | Generate report after fakehub shutdown.                                                                   |\n| `--report-format` | string  | -       | Generated report format. Possible values: `latex` for [LaTeX], `xml` for [XML], and `txt` for plain text. |\n\n## How to contribute?\n\nMake sure that you have [Rust], [just], [npm], and Java 21+ installed on your\nsystem, then fork this repository, make changes, send us a\n[pull request][guidelines]. We will review your changes and apply them to the\n`master` branch shortly, provided they don't violate our quality standards. To\navoid frustration, before sending us your pull request please run full build:\n\n```bash\njust full\n```\n\nHere is the [contribution vitals][Zerocracy Vitals], made by [zerocracy/judges-action]\n(updated every hour!).\n\n[GitHub REST API]: https://docs.github.com/en/rest?apiVersion=2022-11-28\n[fakehub-crate]: https://crates.io/crates/fakehub\n[LaTeX]: https://en.wikipedia.org/wiki/LaTeX\n[XML]: https://en.wikipedia.org/wiki/XML\n[JSON]: https://en.wikipedia.org/wiki/JSON\n[Rust]: https://www.rust-lang.org/tools/install\n[npm]: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm\n[guidelines]: https://www.yegor256.com/2014/04/15/github-guidelines.html\n[just]: https://just.systems/man/en/chapter_4.html\n[Zerocracy Vitals]: https://www.h1alexbel.xyz/fakehub/zerocracy/fakehub-vitals.html\n[zerocracy/judges-action]: https://github.com/zerocracy/judges-action\n[GitHub REST API Get Repo]: https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#get-a-repository\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh1alexbel%2Ffakehub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fh1alexbel%2Ffakehub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh1alexbel%2Ffakehub/lists"}