Create and Add Fixtures

During the process of development, you may want to create a new fixture record and add it to the project to demonstrate or test a new feature. This page demonstrates sample strategies and workflows.

Bulk add fixtures to docker development instance

  1. Make sure the application is up and running at https://127.0.0.1:5000/ via invenio-cli run (see Dev docker setup)

  2. In a new bash tab or window, nav back into the cloned project directory.

  3. Now clone the ultraviolet-fixtures repository into a fixtures directory with the following command. (.fixtures is gitignored, so don’t worry about it getting committed!)

  git clone git@github.com:ADDLOCATIONHERE,TBD fixtures
  1. Post the fixture records to the instance via uv-cli
      pipenv run uv-cli fixtures ingest
    
  2. If you want to change a fixture and repost, the easiest way is to locally edit the JSON from the cloned ultraviolet-fixtures. Then remove all the fixtures with and re-ingest them:
      pipenv run uv-cli fixtures purge
      pipenv run uv-cli fixtures ingest
    

Pro tip 1: When you first run pipenv run uv-cli fixtures ingest or pipenv run uv-clifixtures purge, a new token will be created and logged to the console.

You can copy that token and pass it directly via the --token flag going forward to speed up your commands, e.g., pipenv run uv-cli fixtures ingest --token <YOUR_TOKEN>

Pro tip 2: The results of your fixture API posts are logged to the gitignored file ./tmp/fixture-map.json, which pairs the internal fixture id (e.g., UV-10) with the pid generated by the UltraViolet instance (e.g., v494d-1tz78). If you need to debug, this is a good place to look.

Making a new metadata record

First, generate a new metadata record that has only the descriptive Invenio schema elements and no “system-generated” elements. A quick and convenient way to do this is to launch the application locally, log in as admin@test.com pass adminpassword and use the deposit form to create a record from scratch.

Once it’s submitted, visit that item show page and view it as JSON. Just change the item URL to https://127.0.0.1:5000/api/records/p6s1v-nzd59/. Note that the p6s1v-nzd59 will change, as it is a system-generated ID. Copy the file and paste it into a new text file and strip out all of the “system generated” elements.

Preparing the data

TBA

Indexing locally to test

TBA

Submitting a pull request

If all looks good, stage your changes and submit them to the project as a pull request.