def test_save_without_id_doesnt_call_update(self): res = MockResource() m = Model(res, **ATTRIBUTE_SET) m.save() self.assertFalse(res.update.called)
def test_save_without_id_calls_create(self): res = MockResource() m = Model(res, **ATTRIBUTE_SET) m.save() self.assertTrue(res.create.called)
def test_save_with_id_when_exists_doesnt_call_create(self): res = MockResource(exists=True) m = Model(res, **ID_ATTRIBUTE_SET) m.save() self.assertFalse(res.create.called)
def test_save_with_id_when_exists_calls_update(self): res = MockResource(exists=True) m = Model(res, **ID_ATTRIBUTE_SET) m.save() self.assertTrue(res.update.called)
def test_save_with_id_when_not_exist_doesnt_call_update(self): res = MockResource() m = Model(res, **ID_ATTRIBUTE_SET) m.save() self.assertFalse(res.update.called)
def test_save_with_id_when_not_exist_calls_create(self): res = MockResource() m = Model(res, **ID_ATTRIBUTE_SET) m.save() self.assertTrue(res.create.called)