Skip to content

Commit

Permalink
[FIX] edi_oca: Adapt tests to changes on error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
etobella committed Sep 26, 2023
1 parent 88750e5 commit a5da7ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions edi_oca/tests/test_security.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,18 @@ def test_group_create(self):
def test_rule_no_create(self):
self.user.write({"groups_id": [(4, self.group.id)]})
self.consumer_record.name = "no_rule"
with self.assertRaisesRegex(AccessError, "Exchange Record rule demo"):
with self.assertRaises(AccessError):
self.create_record(self.user)

@mute_logger("odoo.addons.base.models.ir_model")
def test_no_group_no_create(self):
with self.assertRaisesRegex(AccessError, "You are not allowed to modify"):
with self.assertRaises(AccessError):
self.create_record(self.user)

@mute_logger("odoo.addons.base.models.ir_model")
def test_no_group_no_read(self):
exchange_record = self.create_record()
with self.assertRaisesRegex(AccessError, "You are not allowed to access"):
with self.assertRaises(AccessError):
exchange_record.with_user(self.user).read()

@mute_logger("odoo.addons.base.models.ir_rule")
Expand All @@ -106,13 +106,13 @@ def test_rule_no_read(self):
self.user.write({"groups_id": [(4, self.group.id)]})
self.assertTrue(exchange_record.with_user(self.user).read())
self.consumer_record.name = "no_rule"
with self.assertRaisesRegex(AccessError, "Exchange Record rule demo"):
with self.assertRaises(AccessError):
exchange_record.with_user(self.user).read()

@mute_logger("odoo.addons.base.models.ir_model")
def test_no_group_no_unlink(self):
exchange_record = self.create_record()
with self.assertRaisesRegex(AccessError, "You are not allowed to modify"):
with self.assertRaises(AccessError):
exchange_record.with_user(self.user).unlink()

@mute_logger("odoo.models.unlink")
Expand All @@ -126,7 +126,7 @@ def test_rule_no_unlink(self):
exchange_record = self.create_record()
self.user.write({"groups_id": [(4, self.group.id)]})
self.consumer_record.name = "no_rule"
with self.assertRaisesRegex(AccessError, "Exchange Record rule demo"):
with self.assertRaises(AccessError):
exchange_record.with_user(self.user).unlink()

def test_no_group_no_search(self):
Expand Down Expand Up @@ -197,7 +197,7 @@ def test_search_no_record_admin(self):
@mute_logger("odoo.addons.base.models.ir_model")
def test_no_group_no_write(self):
exchange_record = self.create_record()
with self.assertRaisesRegex(AccessError, "You are not allowed to modify"):
with self.assertRaises(AccessError):
exchange_record.with_user(self.user).write({"external_identifier": "1234"})

def test_group_write(self):
Expand All @@ -211,5 +211,5 @@ def test_rule_no_write(self):
exchange_record = self.create_record()
self.user.write({"groups_id": [(4, self.group.id)]})
self.consumer_record.name = "no_rule"
with self.assertRaisesRegex(AccessError, "Exchange Record rule demo"):
with self.assertRaises(AccessError):
exchange_record.with_user(self.user).write({"external_identifier": "1234"})
4 changes: 2 additions & 2 deletions edi_oca/views/edi_backend_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<record id="edi_backend_view_tree" model="ir.ui.view">
<field name="model">edi.backend</field>
<field name="arch" type="xml">
<tree string="EDI Backend" decoration-muted="(not active)">
<tree decoration-muted="(not active)">
<field name="name" />
<field name="active" />
</tree>
Expand All @@ -12,7 +12,7 @@
<record id="edi_backend_view_form" model="ir.ui.view">
<field name="model">edi.backend</field>
<field name="arch" type="xml">
<form string="EDI Backend">
<form>
<sheet>
<widget
name="web_ribbon"
Expand Down

0 comments on commit a5da7ac

Please sign in to comment.