From bc29563a2bd09e575d31c7d146bcd53f98fc84e7 Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Thu, 28 Jan 2010 17:07:17 +0000
Subject: [PATCH] Really check that exception is raised. reviewed by jerome

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32072 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5OOo/tests/testFormPrintoutAsODG.py | 15 ++-------------
 product/ERP5OOo/tests/testFormPrintoutAsODT.py |  8 +-------
 2 files changed, 3 insertions(+), 20 deletions(-)

diff --git a/product/ERP5OOo/tests/testFormPrintoutAsODG.py b/product/ERP5OOo/tests/testFormPrintoutAsODG.py
index 88c782f043..849035f13b 100644
--- a/product/ERP5OOo/tests/testFormPrintoutAsODG.py
+++ b/product/ERP5OOo/tests/testFormPrintoutAsODG.py
@@ -193,12 +193,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
     self.assertTrue(foo_printout.template == 'Foo_getODGStyleSheet')
     tmp_template = foo_printout.template
     foo_printout.template = None
-    # template == None, causes a ValueError
-    try:
-      foo_printout.index_html(request)
-    except ValueError, e:
-      # e -> 'Can not create a ODF Document without a odf_template'
-      self.assertTrue(True)
+    self.assertRaises(ValueError, foo_printout.index_html, request)
 
     # put back
     foo_printout.template = tmp_template
@@ -444,13 +439,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
     self.assertTrue(foo_printout.template == 'Foo_getODGStyleSheet')
     tmp_template = foo_printout.template
     foo_printout.template = None
-    # template == None, causes a ValueError
-    try:
-      foo_printout.index_html(REQUEST=request)
-    except ValueError, e:
-      # e -> 'Can not create a ODF Document without a odf_template'
-      self.assertTrue(True)
-
+    self.assertRaises(ValueError, foo_printout.index_html, request)
     # put back
     foo_printout.template = tmp_template
 
diff --git a/product/ERP5OOo/tests/testFormPrintoutAsODT.py b/product/ERP5OOo/tests/testFormPrintoutAsODT.py
index 4374811a88..ed6d64a54e 100644
--- a/product/ERP5OOo/tests/testFormPrintoutAsODT.py
+++ b/product/ERP5OOo/tests/testFormPrintoutAsODT.py
@@ -189,13 +189,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
     self.assertTrue(foo_printout.template == 'Foo_getODTStyleSheet')
     tmp_template = foo_printout.template
     foo_printout.template = None
-    # template == None, causes a ValueError
-    try:
-      foo_printout.index_html(REQUEST=request)
-    except ValueError, e:
-      # e -> 'Can not create a ODF Document without a odf_template'
-      self.assertTrue(True)
-
+    self.assertRaises(ValueError, foo_printout.index_html, request)
     # put back
     foo_printout.template = tmp_template
 
-- 
2.30.9