Skip to content

Conversation

fw-bot
Copy link
Contributor

@fw-bot fw-bot commented Nov 29, 2024

Improve access related tests for mail.message and their sub models. Currently
tests are dependent on discuss.channel model, and not always written in a
clear way. Understanding the purpose of each test is not crystal clear.

We now use a test model with simple rules, defined in test_mail addon. It
allows to simulate models with

  • public access;
  • portal access;
  • internal access;
  • admin access;

using ACLs and ir.rules. Tests are rewritten to be more concise and precise
and use new models.

This is done in stable to keep coherency in tests codebase. It also eases
writing bugfixes as tests won't have to be modified during forward port
process. Finally it allows to backport improvements or fixes in later
versions if it applies to previous versions.

Task-4320561

Forward-Port-Of: #186394

@robodoo
Copy link
Contributor

robodoo commented Nov 29, 2024

Pull request status dashboard

@fw-bot
Copy link
Contributor Author

fw-bot commented Nov 29, 2024

@tde-banana-odoo cherrypicking of pull request #186394 failed.

stdout:

Auto-merging addons/mail/models/mail_message.py
CONFLICT (content): Merge conflict in addons/mail/models/mail_message.py
Auto-merging addons/mail/tests/test_res_users.py
CONFLICT (content): Merge conflict in addons/mail/tests/test_res_users.py
CONFLICT (modify/delete): addons/mail/tests/test_user_modify_own_profile.py deleted in 4e724323d811dec76c186b5cfff6e4b0135b2128 and modified in 452c250ec816439161a3d374fd4ae6b4752013b0.  Version 452c250ec816439161a3d374fd4ae6b4752013b0 of addons/mail/tests/test_user_modify_own_profile.py left in tree.
Auto-merging addons/test_mail/tests/__init__.py
CONFLICT (content): Merge conflict in addons/test_mail/tests/__init__.py
Auto-merging addons/test_mail/tests/test_mail_message.py
CONFLICT (content): Merge conflict in addons/test_mail/tests/test_mail_message.py

Either perform the forward-port manually (and push to this branch, proceeding as usual) or close this PR (maybe?).

In the former case, you may want to edit this PR message as well.

⚠️ after resolving this conflict, you will need to merge it via @robodoo.

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@robodoo robodoo added forwardport This PR was created by @fw-bot conflict There was an error while creating this forward-port PR labels Nov 29, 2024
@tde-banana-odoo tde-banana-odoo force-pushed the 17.0-16.0-mail-access-tde-CjGw-fw branch 2 times, most recently from 6eff9be to 7df5611 Compare November 29, 2024 10:52
@C3POdoo C3POdoo requested review from a team November 29, 2024 10:53
@C3POdoo C3POdoo added the RD research & development, internal work label Nov 29, 2024
@C3POdoo C3POdoo requested a review from a team November 29, 2024 11:10
Purpose is to separate tests about content from tests about access. It
eases bugfixing and improving features while keeping other tests stable
through versions.

Task-4320561

X-Original-Commit: odoo/odoo@030288e
Purpose is to make tests independent from channel model which has its own
access rules. We now use a test model with simple rules, allowing to
simulate models with

  * public access;
  * portal access;
  * internal access;
  * admin access;

Tests are rewritten to be more concise and precise and use this new model.

This is done in stable to keep coherency in tests codebase. It also eases
writing bugfixes as tests won't have to be modified during forward port
process. Finally it allows to backport improvements or fixes in later
versions if it applies to previous versions.

Task-4320561

X-Original-Commit: odoo/odoo@6370ca1
Use sudo when accessing opportunities messages to update. Individual
access rights should not prevent from updating necessary messages when
moving them and updating subject due to opportunity merge.

Task-4320561

X-Original-Commit: odoo/odoo@93fbc8d
@tde-banana-odoo tde-banana-odoo force-pushed the 17.0-16.0-mail-access-tde-CjGw-fw branch from b02391e to 283c200 Compare November 29, 2024 11:50
@tde-banana-odoo
Copy link
Contributor

@robodoo r+ rebase-merge

@robodoo
Copy link
Contributor

robodoo commented Nov 29, 2024

Merge method set to rebase and merge, using the PR as merge commit message.

robodoo pushed a commit that referenced this pull request Nov 29, 2024
Purpose is to separate tests about content from tests about access. It
eases bugfixing and improving features while keeping other tests stable
through versions.

Task-4320561

X-original-commit: 030288e
Part-of: #189120
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
robodoo pushed a commit that referenced this pull request Nov 29, 2024
Purpose is to make tests independent from channel model which has its own
access rules. We now use a test model with simple rules, allowing to
simulate models with

  * public access;
  * portal access;
  * internal access;
  * admin access;

Tests are rewritten to be more concise and precise and use this new model.

This is done in stable to keep coherency in tests codebase. It also eases
writing bugfixes as tests won't have to be modified during forward port
process. Finally it allows to backport improvements or fixes in later
versions if it applies to previous versions.

Task-4320561

X-original-commit: 6370ca1
Part-of: #189120
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
robodoo pushed a commit that referenced this pull request Nov 29, 2024
Use sudo when accessing opportunities messages to update. Individual
access rights should not prevent from updating necessary messages when
moving them and updating subject due to opportunity merge.

Task-4320561

X-original-commit: 93fbc8d
Part-of: #189120
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
robodoo added a commit that referenced this pull request Nov 29, 2024
Improve access related tests for mail.message and their sub models. Currently
tests are dependent on discuss.channel model, and not always written in a
clear way. Understanding the purpose of each test is not crystal clear.

We now use a test model with simple rules, defined in test_mail addon. It
allows to simulate models with

  * public access;
  * portal access;
  * internal access;
  * admin access;

using ACLs and ir.rules. Tests are rewritten to be more concise and precise
and use new models.

This is done in stable to keep coherency in tests codebase. It also eases
writing bugfixes as tests won't have to be modified during forward port
process. Finally it allows to backport improvements or fixes in later
versions if it applies to previous versions.

Task-4320561

closes #189120

Forward-port-of: #186394
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
@robodoo robodoo closed this Nov 29, 2024
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 29, 2024
Purpose is to separate tests about content from tests about access. It
eases bugfixing and improving features while keeping other tests stable
through versions.

Task-4320561

X-original-commit: odoo/odoo@030288e
Part-of: odoo#189120
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 29, 2024
Purpose is to make tests independent from channel model which has its own
access rules. We now use a test model with simple rules, allowing to
simulate models with

  * public access;
  * portal access;
  * internal access;
  * admin access;

Tests are rewritten to be more concise and precise and use this new model.

This is done in stable to keep coherency in tests codebase. It also eases
writing bugfixes as tests won't have to be modified during forward port
process. Finally it allows to backport improvements or fixes in later
versions if it applies to previous versions.

Task-4320561

X-original-commit: odoo/odoo@6370ca1
Part-of: odoo#189120
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
tde-banana-odoo added a commit to odoo-dev/odoo that referenced this pull request Nov 29, 2024
Use sudo when accessing opportunities messages to update. Individual
access rights should not prevent from updating necessary messages when
moving them and updating subject due to opportunity merge.

Task-4320561

X-original-commit: odoo/odoo@93fbc8d
Part-of: odoo#189120
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
robodoo added a commit that referenced this pull request Nov 29, 2024
Improve access related tests for mail.message and their sub models. Currently
tests are dependent on discuss.channel model, and not always written in a
clear way. Understanding the purpose of each test is not crystal clear.

We now use a test model with simple rules, defined in test_mail addon. It
allows to simulate models with

  * public access;
  * portal access;
  * internal access;
  * admin access;

using ACLs and ir.rules. Tests are rewritten to be more concise and precise
and use new models.

This is done in stable to keep coherency in tests codebase. It also eases
writing bugfixes as tests won't have to be modified during forward port
process. Finally it allows to backport improvements or fixes in later
versions if it applies to previous versions.

Task-4320561

closes #189181

Forward-port-of: #189120
Forward-port-of: #186394
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
robodoo added a commit that referenced this pull request Nov 29, 2024
Improve access related tests for mail.message and their sub models. Currently
tests are dependent on discuss.channel model, and not always written in a
clear way. Understanding the purpose of each test is not crystal clear.

We now use a test model with simple rules, defined in test_mail addon. It
allows to simulate models with

  * public access;
  * portal access;
  * internal access;
  * admin access;

using ACLs and ir.rules. Tests are rewritten to be more concise and precise
and use new models.

This is done in stable to keep coherency in tests codebase. It also eases
writing bugfixes as tests won't have to be modified during forward port
process. Finally it allows to backport improvements or fixes in later
versions if it applies to previous versions.

Task-4320561

closes #189202

Forward-port-of: #189120
Forward-port-of: #186394
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Command.unlink(self.env.ref('base.group_user').id),
Command.link(self.env.ref('base.group_portal').id),
(3, self.env.ref('base.group_user').id),
(4, self.env.ref('base.group_portal').id),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello guys, just curious about why using directly the number (3 and 4) instead of the Command is considered an improvement on this commit?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not ... I had conflicts, removed Command when resolving the conflict, then had an issue with Command usage and fall back on using numbers as I find it easier. But that should effectively not be done in stable, even if not really annoying in tests.

robodoo added a commit that referenced this pull request Dec 2, 2024
Improve access related tests for mail.message and their sub models. Currently
tests are dependent on discuss.channel model, and not always written in a
clear way. Understanding the purpose of each test is not crystal clear.

We now use a test model with simple rules, defined in test_mail addon. It
allows to simulate models with

  * public access;
  * portal access;
  * internal access;
  * admin access;

using ACLs and ir.rules. Tests are rewritten to be more concise and precise
and use new models.

This is done in stable to keep coherency in tests codebase. It also eases
writing bugfixes as tests won't have to be modified during forward port
process. Finally it allows to backport improvements or fixes in later
versions if it applies to previous versions.

Task-4320561

closes #189181

Forward-port-of: #189120
Forward-port-of: #186394
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
@fw-bot fw-bot deleted the 17.0-16.0-mail-access-tde-CjGw-fw branch December 13, 2024 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflict There was an error while creating this forward-port PR forwardport This PR was created by @fw-bot RD research & development, internal work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants