def test_negative_put_without_id(self, session): repository = Repository(session, Data) a = Data() a.__session__ = True with self.assertRaises(EntityNotRecognized): repository.put(a)
def test_negative_put_without_session(self, session): repository = Repository(session, Data) a = Data() a.id = ObjectId() with self.assertRaises(EntityNotRecognized): repository.put(a)
def test_negative_delete_random(self, session): repository = Repository(session, Data) a = Data() a.id = PseudoObjectId() a.__session__ = True with self.assertRaises(EntityNotRecognized): repository.put(a)
def test_positive_put(self, session): repository = Repository(session, Data) a = Data() a.id = ObjectId() a.__session__ = True repository.put(a) session.persist.assert_called_with(a) session.flush.assert_called_with()