From 49c742159174868adc52e8dd2d1420f2c7c2eff8 Mon Sep 17 00:00:00 2001 From: kevgliss Date: Wed, 22 Jul 2015 20:32:29 -0700 Subject: [PATCH] More test fixes --- lemur/database.py | 5 +++-- lemur/tests/test_destinations.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lemur/database.py b/lemur/database.py index 6de3d964..c2bb8f13 100644 --- a/lemur/database.py +++ b/lemur/database.py @@ -176,8 +176,9 @@ def delete(model): :param model: """ - db.session.delete(model) - db.session.commit() + if model: + db.session.delete(model) + db.session.commit() def filter(query, model, terms): diff --git a/lemur/tests/test_destinations.py b/lemur/tests/test_destinations.py index 4274bbe4..37da1299 100644 --- a/lemur/tests/test_destinations.py +++ b/lemur/tests/test_destinations.py @@ -78,7 +78,7 @@ def test_admin_destination_put(client): def test_admin_destination_delete(client): - assert client.delete(api.url_for(Destinations, destination_id=1), headers=VALID_ADMIN_HEADER_TOKEN).status_code == 500 + assert client.delete(api.url_for(Destinations, destination_id=1), headers=VALID_ADMIN_HEADER_TOKEN).status_code == 200 def test_admin_destination_patch(client):