

def test_get_or_create(self):
    message = 'abcd'
    id = '12335'
    error = create_error({
        'id': id,
    }, message=message, attempts=2)
    error.save()
    get = PillowError.get_or_create({
        'id': id,
    }, FakePillow())
    self.assertEqual(get.total_attempts, 2)
    self.assertEqual(get.current_attempt, 2)
    self.assertTrue((message in error.error_traceback))
    new = PillowError.get_or_create({
        'id': id,
    }, FakePillow1())
    self.assertIsNone(new.id)
    self.assertEqual(new.current_attempt, 0)

dataset/ETHPy150Open dimagi/commcare-hq/corehq/ex-submodules/pillow_retry/tests.py PillowRetryTestCase.test_get_or_create/original