# Working with fixtures

This document outlines key moments of working with fixtures which are stored in the fixtures folder.

# Product fixtures

Product fixtures are basically Product Templates which are exported/imported using following management commands:

  1. export_product (see ./manage.py export_product -h),
  2. import_product (see ./manage.py import_product -h).

# Creating a Product fixture

In order to create a Product fixture, follow these steps:

  1. Prepare the Product in the BriteLines user interface.
  2. Export Product using ./manage.py export_product {product_name} -u.
  3. Run mv {product_name} fixtures to move created Template over to the fixtures folder.
  4. Optionally, clean up created files: rm {product_name}.britelinestemplate.
  5. Commit/push the changes and submit a PR.

# Updating a Product fixture

In order to update a Product fixture, follow these steps:

  1. Import Product fixture using ./manage.py import_product fixtures/{product_name}.
  2. Update the Product in the BriteLines user interface.
  3. Export Product using ./manage.py export_product {product_name} -u.
  4. Run rm -rf fixtures/{product_name} && mv {product_name} fixtures to update the fixture.
  5. Optionally, clean up created files: rm {product_name}.britelinestemplate.
  6. Commit/push the changes and submit a PR.