It is not easy to have a test file that includes multiple test cases that use different sets of test data for the same resource. It can also make simple test cases much more difficult to understand when the test data is scattered across different files.
Adding one or two params to setup_data could improve both of these issues. I want to be able to use it like:
class MyTest(SparklyTest):
es = ElasticFixture(...)
def test_a(self):
es.setup_data(path='fixtures/test_input.json')
...
def test_b(self):
es.setup_data(
data=[
{'_id': '1', '_source': {'attr_1': 'foo', 'attr_2': 42}}
{'_id': '2', '_source': {'attr_1': 'bar', 'attr_2': 314}}
]
)
...
def tearDown(self):
es.teardown_data()
It is not easy to have a test file that includes multiple test cases that use different sets of test data for the same resource. It can also make simple test cases much more difficult to understand when the test data is scattered across different files.
Adding one or two params to setup_data could improve both of these issues. I want to be able to use it like: