Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Getafix is a program which will automatically create and update your fixture data. Configuration is easy, since all you need to do is recreate the API's url structure locally.
Perhaps it's easier to show rather than tell...
Create a folder to hold your fixtures. Let's call it 'fixtures'.
[ app/ ] $ mkdir fixtures && cd fixtures
Start recreating the API structure by creating folders and files to represent endpoints. Each endpoint should be a file with a ".json" extension. Leave them as empty files.
[ app/fixtures/ ] $ mkdir users
[ app/fixtures/ ] $ touch users/2.json
[ app/fixtures/ ] $ mkdir users/2
[ app/fixtures/ ] $ touch users/2/tracks.json
Configure the base so that Getafix knows where to request the data from. Configuration is done with files named ".getafix".
app/fixtures/ $ echo "base: 'https://api.example.com'" > .getafix
Run getafix, pointing it to your fixtures directory:
app/ $ getafix fixtures
In this example, getafix would make requests to:
https://api.example.com/users/2
https://api.example.com/users/2/tracks
And save the results back into the JSON files. Adding more fixtures is just a case of creating more empty files.
Configuration files are interpretted as CoffeeScript.
base
(String) All files beyond this point use this value as a base for the url to request. Folder structure up to this point
is ignored.headers
(Object) A map of headers to include in the request.query
(Object) A map of query parameters to include. Useful if you need to always include a client id or similar in every request.map
(Function) A function which allows for a custom method of building the url from the folder structure. It is
passed one variable: path
and should return a string which is appended to the base
.To create different configs for certain endpoints, add extra .getafix
configuration files in the appropriate folder.
When more than one config lies in the path to an endpoint, the values are merged together.
/fixtures
.getafix
# base: 'https://api.example.com'
# query: client: 123
/users
2.json # requests: https://api.example.com/users/2?client=123
/2
tracks.json # requests: https://api.example.com/users/2/tracks.json?client=123
/resolve
.getafix
# map: (path) -> '/resolve?url=example.com/' + path
foo.json # requests: https://api.example.com/resolve?url=example.com/foo&client=123
/bar
baz.json # requests: https://api.example.com/resolve?url=example.com/bar/baz&client=123
/internal
.getafix
# base: 'https://api-int.example.com'
/users
2.json # requests: https://api-int.example.com/users/2.json?client=123
MIT
Nick Fisher (@spadgos), SoundCloud (@soundcloud)
FAQs
Fixture downloader
The npm package getafix receives a total of 1 weekly downloads. As such, getafix popularity was classified as not popular.
We found that getafix demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.