Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-sized batching doesn't creates no batches when only one record #693

Open
maxf opened this issue Oct 30, 2023 · 0 comments
Open

Auto-sized batching doesn't creates no batches when only one record #693

maxf opened this issue Oct 30, 2023 · 0 comments

Comments

@maxf
Copy link

maxf commented Oct 30, 2023

The _add_autosized_batches function creates no batch when only one record is passed as data.
The test below creates a single object, passes it to the function and checks that only one batch was created.
However none are created so the test fails

    @mock.patch('simple_salesforce.bulk.SFBulkType._add_batch')
    def test_add_autosized_batches_single_record(self, add_batch):
        """Test that _add_autosized_batches a single record correctly"""
        add_batch.side_effect = lambda job_id, data, operation: data
        sf_bulk_type = SFBulkType(None, None, None, None)
        data = [{'key': 'value'}]
        result = sf_bulk_type._add_autosized_batches(  # pylint: disable=protected-access
            data=data, operation="update", job="Job-1"
        )
        self.assertEqual(len(result), 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant