Skip to content

Support passing data a param to Fixture.setup_data() #28

@albertc1

Description

@albertc1

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()

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions