dirn/Simon

Add model factory for unit tests

Closed this issue · 0 comments

dirn commented

There are way too many models being defined in the test suite. The problem is that different tests require different options to be set. New models keep getting created to prevent changes from negatively impacting other tests.

A better way to handle this would be with a factory that creates a model configured the way the test needs.

Some quick thoughts:

TestModel = ModelFactory(auto_timestamp=False, required_fields='a')
TestModel2 = ModelFactory(field_map={'a': 'b'}, spec=TestModel)

The factory probably should not be used in TestMetaClass.