fixture — Camelot documentation

### Navigation

- index
- modules |
- next |
- previous |
- Camelot documentation »
- Camelot API »
- model »

# fixture

class `camelot.model.fixture.` `Fixture`(**kwargs)

  Keep track of static data loaded into the database

  classmethod `findFixture`(entity, fixture_key, fixture_class=None)

    Find a registered fixture, return None if no fixture is found

  classmethod `findFixtureKey`(entity, primary_key)

    Find the fixture key for an object of type entity with primary key :return: fixture_key

  classmethod `findFixtureKeyAndClass`(obj)

    Find the fixture key and class of an object @param obj: the object we are looking for @return: (fixture_key, fixture_class) if the object is a registered fixture, (None, None) otherwise

  classmethod `findFixtureKeysAndClasses`(entity)

    Load all fixture keys of a certain entity in batch :param entity: the model class for which the fixtures should be found :return: a dictionary mapping the primary key of a on object of type entity to its (fixture key, fixture class)

  classmethod `removeFixture`(entity, fixture_key, fixture_class)

    Remove a fixture from the database

class `camelot.model.fixture.` `FixtureVersion`(**kwargs)

  Keep track of the version the fixtures have in the current database, the subversion revision number is a good candidate to be used as a fixture version.

  Returns: | an integer representing the current version, 0 if no version found

  classmethod `get_current_version`(fixture_class=None)

    Get the current version of the fixtures in the database for a certain fixture class.

    Parameters: | fixture_class – the fixture class for which to get the version

  classmethod `set_current_version`(fixture_class=None, fixture_version=0)

    Set the current version of the fixtures in the database for a certain fixture class.

    Parameters: | fixture_class – the fixture class for which to get the version fixture_version – the version number to which to set the fixture version

### Navigation

- index
- modules |
- next |
- previous |
- Camelot documentation »
- Camelot API »
- model »

Comments
blog comments powered by Disqus