This commit refactors discuss code to use OWL components and new tools and services in web/. Functionally, Discuss app should work relatively the same as before this commit. closes https://github.com/odoo/odoo/pull/110188 Related: https://github.com/odoo/enterprise/pull/38058 https://github.com/odoo/upgrade/pull/4423 closes odoo/odoo#110188 Related: odoo/upgrade#4423 Related: odoo/enterprise#38058 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com> Co-authored-by: Alexandre (aku) <aku@odoo.com> Co-authored-by: Didier (did) <did@odoo.com> Co-authored-by: Géry (ged) <ged@odoo.com> Co-authored-by: Louis (wil) <wil@odoo.com> Co-authored-by: Maël (mapa) <mapa@odoo.com> Co-authored-by: Maryam (maki) <maki@odoo.com> Co-authored-by: Sébastien (seb) <seb@odoo.com> Co-authored-by: Thanh (tso) <tso@odoo.com> Co-authored-by: Matthieu (tsm) <tsm@odoo.com> Co-authored-by: Zelong (zel) <zel@odoo.com>
76 lines
2.7 KiB
JavaScript
76 lines
2.7 KiB
JavaScript
/** @odoo-module **/
|
|
|
|
import { click, start, startServer } from "@mail/../tests/helpers/test_utils";
|
|
|
|
QUnit.module("activity (patch)");
|
|
|
|
QUnit.test("grant course access", async (assert) => {
|
|
const pyEnv = await startServer();
|
|
const partnerId = pyEnv["res.partner"].create({});
|
|
const channelId = pyEnv["slide.channel"].create({});
|
|
pyEnv["mail.activity"].create({
|
|
can_write: true,
|
|
res_id: channelId,
|
|
request_partner_id: partnerId,
|
|
res_model: "slide.channel",
|
|
});
|
|
const { openView } = await start({
|
|
async mockRPC(route, args) {
|
|
if (args.method === "action_grant_access") {
|
|
assert.strictEqual(args.args.length, 1);
|
|
assert.strictEqual(args.args[0].length, 1);
|
|
assert.strictEqual(args.args[0][0], channelId);
|
|
assert.strictEqual(args.kwargs.partner_id, partnerId);
|
|
assert.step("access_grant");
|
|
// random value returned in order for the mock server to know that this route is implemented.
|
|
return true;
|
|
}
|
|
},
|
|
});
|
|
await openView({
|
|
res_id: channelId,
|
|
res_model: "slide.channel",
|
|
views: [[false, "form"]],
|
|
});
|
|
assert.containsOnce($, ".o-mail-Activity");
|
|
assert.containsOnce($, "button:contains(Grant Access)");
|
|
|
|
await click("button:contains(Grant Access)");
|
|
assert.verifySteps(["access_grant"]);
|
|
});
|
|
|
|
QUnit.test("refuse course access", async (assert) => {
|
|
const pyEnv = await startServer();
|
|
const partnerId = pyEnv["res.partner"].create({});
|
|
const channelId = pyEnv["slide.channel"].create({});
|
|
pyEnv["mail.activity"].create({
|
|
can_write: true,
|
|
res_id: channelId,
|
|
request_partner_id: partnerId,
|
|
res_model: "slide.channel",
|
|
});
|
|
const { openView } = await start({
|
|
async mockRPC(route, args) {
|
|
if (args.method === "action_refuse_access") {
|
|
assert.strictEqual(args.args.length, 1);
|
|
assert.strictEqual(args.args[0].length, 1);
|
|
assert.strictEqual(args.args[0][0], channelId);
|
|
assert.strictEqual(args.kwargs.partner_id, partnerId);
|
|
assert.step("access_refuse");
|
|
// random value returned in order for the mock server to know that this route is implemented.
|
|
return true;
|
|
}
|
|
},
|
|
});
|
|
await openView({
|
|
res_id: channelId,
|
|
res_model: "slide.channel",
|
|
views: [[false, "form"]],
|
|
});
|
|
assert.containsOnce($, ".o-mail-Activity");
|
|
assert.containsOnce($, "button:contains(Refuse Access)");
|
|
|
|
await click("button:contains(Refuse Access)");
|
|
assert.verifySteps(["access_refuse"]);
|
|
});
|