def test_put_overwrite(self, es):
        sd = SplitterDiffs()
        sd.put("lablab", "oldold", "newnew", {"some": "structure"})

        diffs = Diff.objects.all()
        self.assertEqual(1, len(diffs))
        self.assertEqual({"some": "structure"}, diffs[0].diff)

        sd.put("lablab", "oldold", "newnew", {"other": "structure"})
        diffs = Diff.objects.all()
        self.assertEqual(1, len(diffs))
        self.assertEqual({"other": "structure"}, diffs[0].diff)
    def test_put(self, es):
        sd = SplitterDiffs()
        sd.put("lablab", "oldold", "newnew", {"some": "structure"})

        diffs = Diff.objects.all()
        self.assertEqual(1, len(diffs))

        self.assertEqual("lablab", diffs[0].label)
        self.assertEqual("oldold", diffs[0].old_version)
        self.assertEqual("newnew", diffs[0].new_version)
        self.assertEqual({"some": "structure"}, diffs[0].diff)

        self.assertTrue(es.return_value.index.called)
        args, kwargs = es.return_value.index.call_args
        self.assertEqual(3, len(args))
        self.assertEqual("diff", args[1])
        self.assertEqual("lablab/oldold/newnew", kwargs["id"])
        self.assertEqual(
            {"label": "lablab", "old_version": "oldold", "new_version": "newnew", "diff": {"some": "structure"}},
            args[2],
        )