Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] edi_oca: Adapt tests to changes on error messages #819

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading