aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-02-27 11:14:22 +0000
committerMichael Wood <michael.g.wood@intel.com>2015-02-27 11:15:29 +0000
commit77e1417ca027770258095eda17290923d3118bad (patch)
tree1d9a88347bedf4d59fe80e7d02c70cedc43df081
parent63b2944e38967f2ecdea176f7328a376335bd6df (diff)
downloaderror-report-web-77e1417ca027770258095eda17290923d3118bad.tar.gz
error-report-web-77e1417ca027770258095eda17290923d3118bad.tar.bz2
error-report-web-77e1417ca027770258095eda17290923d3118bad.zip
test: Make sure we delete the data between tests
Needed to do the before the test is run and check afterwards. Also remove unneeded delete as the deletion will cascade to the foreign key items. Signed-off-by: Michael Wood <michael.g.wood@intel.com>
-rwxr-xr-xPost/test.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/Post/test.py b/Post/test.py
index 35f9fa6..a5874b4 100755
--- a/Post/test.py
+++ b/Post/test.py
@@ -4,22 +4,24 @@ import json
from django.test import Client
from Post.models import BuildFailure, Build
-
+#Delete the data between tests
def delete_data_after (func):
def wrap(*args, **kwargs):
- func(*args, **kwargs)
self = args[0]
- bfo = BuildFailure.objects.all()
bo = Build.objects.all()
+ bfo = BuildFailure.objects.all()
+
+ bo.delete()
+
+ # run the test
+ func(*args, **kwargs)
+ # The submission should have added one row in each table
self.assertEqual(bfo.count(), 1)
self.assertEqual(bo.count(), 1)
- bfo.delete()
- bo.delete()
-
return wrap