From 16ce92cbc0866bf0586dded93cd9ecfc3948bffb Mon Sep 17 00:00:00 2001 From: Yohann Gabory Date: Mon, 11 May 2015 22:52:51 +0200 Subject: [PATCH] add tests --- .../tests/test_db_projection_integration.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drunken_boat/db/postgresql/tests/test_db_projection_integration.py b/drunken_boat/db/postgresql/tests/test_db_projection_integration.py index 3248456..a880e42 100644 --- a/drunken_boat/db/postgresql/tests/test_db_projection_integration.py +++ b/drunken_boat/db/postgresql/tests/test_db_projection_integration.py @@ -213,6 +213,28 @@ def test_projection_update(prepare_test): assert p == [(4,)] +def test_projection_delete(prepare_test): + projection = projections_fixtures.TestProjectionWithVirtual(get_test_db()) + projection.insert( + {"title": "dummy", + "introduction": "a meaningfull introduction"}) + assert projection.delete("title=%s", ("dummy",)) == [] + projection.insert( + {"title": "dummy", + "introduction": "a meaningfull introduction"}) + assert projection.delete(Where("title", "=", "%s"), ("dummy",)) == [] + pytest.raises(ProgrammingError, + projection.delete, + Where("name", "=", "%s"), ("Pouet",)) + projection.insert( + {"title": "dummy", + "introduction": "a meaningfull introduction"}) + p = projection.delete(Where("title", "=", "%s"), + ("dummy",), + returning="self") + assert isinstance(p[0], DataBaseObject) + + def test_projection_foreign(prepare_test): projection_author = projections_fixtures.AuthorProjection(get_test_db()) projection_author.insert(