{"id":16784995,"url":"https://github.com/michaelsauter/bock","last_synced_at":"2026-04-17T00:02:14.720Z","repository":{"id":137067597,"uuid":"266733983","full_name":"michaelsauter/bock","owner":"michaelsauter","description":"Bock mocks binaries.","archived":false,"fork":false,"pushed_at":"2020-05-28T07:23:17.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-20T13:38:09.784Z","etag":null,"topics":["bash","mock"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaelsauter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2020-05-25T09:08:41.000Z","updated_at":"2020-05-27T10:00:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"051bfc4e-bf32-482d-acd9-9ee7e07830e6","html_url":"https://github.com/michaelsauter/bock","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/michaelsauter/bock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelsauter%2Fbock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelsauter%2Fbock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelsauter%2Fbock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelsauter%2Fbock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelsauter","download_url":"https://codeload.github.com/michaelsauter/bock/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelsauter%2Fbock/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31909235,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"ssl_error","status_checked_at":"2026-04-16T18:21:47.142Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["bash","mock"],"created_at":"2024-10-13T08:07:53.060Z","updated_at":"2026-04-17T00:02:14.632Z","avatar_url":"https://github.com/michaelsauter.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bock mocks binaries.\n\nCAUTION: `bock` is just a proof-of-concept at this stage. It is by no means feature complete or even correct in many cases. Use at your own risk.\n\nSometimes, one might mock a binary instead of using the real one.\nAn example use case is mocking `oc`, the CLI binary to interact with OpenShift.\nOpenShift is, depending on the host, tricky to install and resource intensive.\nUsing `bock`, one can mock the interaction to avoid running an actual cluster.\n\n`bock` works by storing the mocked interactions in a temporary file named\n`.bock-want` and the actual invocations in a file named `.bock-got`, which can\nbe compared by calling `mock --verify`.\n\n## Usage\n\nTo use `bock`, download `bock.sh` into a folder, but give it the  name of the\nbinary to mock, e.g. `git` or `oc`. Then prepend your `$PATH` with that folder\nin your test script. See\nhttps://github.com/michaelsauter/bock/blob/master/tests/run.sh or the following\nexample:\n\n```\n#!/usr/bin/env bash\nset -ue\n\n# Download script\ncurl -L \"https://raw.githubusercontent.com/michaelsauter/bock/master/bock.sh\" -o oc \u0026\u0026 chmod +x oc\n\n# Prepend to your path\nSCRIPT_DIR=\"$(cd \"$(dirname \"${BASH_SOURCE[0]}\")\" \u0026\u0026 pwd)\"\nPATH=${SCRIPT_DIR}:$PATH\n\n# Check interactions at the end\ntrap \"oc mock --verify\" EXIT\n\n# Define interactions\noc mock --receive whoami --stdout \"Max Mustermann\" --times 1\n\n# Run code that uses \"oc\" binary ... typically you'd execute your script to test here\noc whoami\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelsauter%2Fbock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelsauter%2Fbock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelsauter%2Fbock/lists"}