From 3b5dc2cf348da8854283db31bbc3bba0b2a68d85 Mon Sep 17 00:00:00 2001
From: Yusuke Muraoka <yusuke@nexedi.com>
Date: Thu, 4 Feb 2010 10:38:16 +0000
Subject: [PATCH] clean up a bit

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32259 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testAdvancedInvoicing.py | 77 +++++++++++----------
 1 file changed, 42 insertions(+), 35 deletions(-)

diff --git a/product/ERP5/tests/testAdvancedInvoicing.py b/product/ERP5/tests/testAdvancedInvoicing.py
index d611fcccbf..fa9c1610f9 100644
--- a/product/ERP5/tests/testAdvancedInvoicing.py
+++ b/product/ERP5/tests/testAdvancedInvoicing.py
@@ -1148,53 +1148,60 @@ class TestWorkflow(SecurityTestCase):
     self.assertEquals(sale_invoice.getSimulationState(), 'auto_planned')
 
     # other as anonymous
-    self.failIfUserCanAccessDocument(self.other.getId(), sale_invoice)
-    self.failIfUserCanAddDocument(self.other.getId(), sale_invoice)
-    self.failIfUserCanDeleteDocument(self.other.getId(), sale_invoice)
-    self.failIfUserCanModifyDocument(self.other.getId(), sale_invoice)
-    self.failIfUserCanViewDocument(self.other.getId(), sale_invoice)
+    username = self.other.getReference()
+    self.failIfUserCanAccessDocument(username, sale_invoice)
+    self.failIfUserCanAddDocument(username, sale_invoice)
+    self.failIfUserCanDeleteDocument(username, sale_invoice)
+    self.failIfUserCanModifyDocument(username, sale_invoice)
+    self.failIfUserCanViewDocument(username, sale_invoice)
 
     # assignee
-    self.assertUserCanAccessDocument(self.assignee.getId(), sale_invoice)
-    self.assertUserCanAddDocument(self.assignee.getId(), sale_invoice)
-    self.assertUserCanDeleteDocument(self.assignee.getId(), sale_invoice)
-    self.assertUserCanModifyDocument(self.assignee.getId(), sale_invoice)
-    self.assertUserCanViewDocument(self.assignee.getId(), sale_invoice)
+    username = self.assignee.getReference()
+    self.assertUserCanAccessDocument(username, sale_invoice)
+    self.assertUserCanAddDocument(username, sale_invoice)
+    self.assertUserCanDeleteDocument(username, sale_invoice)
+    self.assertUserCanModifyDocument(username, sale_invoice)
+    self.assertUserCanViewDocument(username, sale_invoice)
 
     # assignor
-    self.assertUserCanAccessDocument(self.assignor.getId(), sale_invoice)
-    self.assertUserCanAddDocument(self.assignor.getId(), sale_invoice)
-    self.assertUserCanDeleteDocument(self.assignor.getId(), sale_invoice)
-    self.assertUserCanModifyDocument(self.assignor.getId(), sale_invoice)
-    self.assertUserCanViewDocument(self.assignor.getId(), sale_invoice)
+    username = self.assignor.getReference()
+    self.assertUserCanAccessDocument(username, sale_invoice)
+    self.assertUserCanAddDocument(username, sale_invoice)
+    self.assertUserCanDeleteDocument(username, sale_invoice)
+    self.assertUserCanModifyDocument(username, sale_invoice)
+    self.assertUserCanViewDocument(username, sale_invoice)
 
     # associate
-    self.assertUserCanAccessDocument(self.associate.getId(), sale_invoice)
-    self.assertUserCanAddDocument(self.associate.getId(), sale_invoice)
-    self.assertUserCanDeleteDocument(self.associate.getId(), sale_invoice)
-    self.assertUserCanModifyDocument(self.associate.getId(), sale_invoice)
-    self.assertUserCanViewDocument(self.associate.getId(), sale_invoice)
+    username = self.associate.getReference()
+    self.assertUserCanAccessDocument(username, sale_invoice)
+    self.assertUserCanAddDocument(username, sale_invoice)
+    self.assertUserCanDeleteDocument(username, sale_invoice)
+    self.assertUserCanModifyDocument(username, sale_invoice)
+    self.assertUserCanViewDocument(username, sale_invoice)
 
     # auditor
-    self.assertUserCanAccessDocument(self.auditor.getId(), sale_invoice)
-    self.failIfUserCanAddDocument(self.auditor.getId(), sale_invoice)
-    self.failIfUserCanDeleteDocument(self.auditor.getId(), sale_invoice)
-    self.failIfUserCanModifyDocument(self.auditor.getId(), sale_invoice)
-    self.assertUserCanViewDocument(self.auditor.getId(), sale_invoice)
+    username = self.auditor.getReference()
+    self.assertUserCanAccessDocument(username, sale_invoice)
+    self.failIfUserCanAddDocument(username, sale_invoice)
+    self.failIfUserCanDeleteDocument(username, sale_invoice)
+    self.failIfUserCanModifyDocument(username, sale_invoice)
+    self.assertUserCanViewDocument(username, sale_invoice)
 
     # author
-    self.failIfUserCanAccessDocument(self.author.getId(), sale_invoice)
-    self.failIfUserCanAddDocument(self.author.getId(), sale_invoice)
-    self.failIfUserCanDeleteDocument(self.author.getId(), sale_invoice)
-    self.failIfUserCanModifyDocument(self.author.getId(), sale_invoice)
-    self.failIfUserCanViewDocument(self.author.getId(), sale_invoice)
+    username = self.author.getReference()
+    self.failIfUserCanAccessDocument(username, sale_invoice)
+    self.failIfUserCanAddDocument(username, sale_invoice)
+    self.failIfUserCanDeleteDocument(username, sale_invoice)
+    self.failIfUserCanModifyDocument(username, sale_invoice)
+    self.failIfUserCanViewDocument(username, sale_invoice)
 
     # manager
-    self.assertUserCanAccessDocument(self.manager.getId(), sale_invoice)
-    self.assertUserCanAddDocument(self.manager.getId(), sale_invoice)
-    self.assertUserCanDeleteDocument(self.manager.getId(), sale_invoice)
-    self.assertUserCanModifyDocument(self.manager.getId(), sale_invoice)
-    self.assertUserCanViewDocument(self.manager.getId(), sale_invoice)
+    username = self.manager.getReference()
+    self.assertUserCanAccessDocument(username, sale_invoice)
+    self.assertUserCanAddDocument(username, sale_invoice)
+    self.assertUserCanDeleteDocument(username, sale_invoice)
+    self.assertUserCanModifyDocument(username, sale_invoice)
+    self.assertUserCanViewDocument(username, sale_invoice)
 
     self.assertSameSet(('confirm_action', 'plan_action',),
         [action['id'] for action in self.portal.portal_workflow.getActionsFor(sale_invoice)
-- 
2.30.9