[FIX] spreadsheet: don't use constant uid in tests
Most tests that need the user id simply use `uid=7`, which will fail if the default user id ever change in the tests. This commit replaces it by `sessuin.user_context.uid`. closes odoo/odoo#138733 Task: 3553122 Related: odoo/enterprise#48965 Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import { createSpreadsheetWithChart, insertChartInSpreadsheet } from "../../util
|
||||
import { createModelWithDataSource, waitForDataSourcesLoaded } from "../../utils/model";
|
||||
import * as spreadsheet from "@odoo/o-spreadsheet";
|
||||
import { makeServerError } from "@web/../tests/helpers/mock_server";
|
||||
import { session } from "@web/session";
|
||||
|
||||
const { toZone } = spreadsheet.helpers;
|
||||
|
||||
@@ -216,6 +217,7 @@ QUnit.module("spreadsheet > odoo chart plugin", {}, () => {
|
||||
|
||||
QUnit.test("can import (export) contextual domain", async function (assert) {
|
||||
const chartId = "1";
|
||||
const uid = session.user_context.uid;
|
||||
const spreadsheetData = {
|
||||
sheets: [
|
||||
{
|
||||
@@ -251,7 +253,7 @@ QUnit.module("spreadsheet > odoo chart plugin", {}, () => {
|
||||
spreadsheetData,
|
||||
mockRPC: function (route, args) {
|
||||
if (args.method === "web_read_group") {
|
||||
assert.deepEqual(args.kwargs.domain, [["foo", "=", 7]]);
|
||||
assert.deepEqual(args.kwargs.domain, [["foo", "=", uid]]);
|
||||
assert.step("web_read_group");
|
||||
}
|
||||
},
|
||||
|
||||
@@ -583,6 +583,7 @@ QUnit.module("spreadsheet > list plugin", {}, () => {
|
||||
);
|
||||
|
||||
QUnit.test("can import (export) contextual domain", async function (assert) {
|
||||
const uid = session.user_context.uid;
|
||||
const spreadsheetData = {
|
||||
lists: {
|
||||
1: {
|
||||
@@ -598,7 +599,7 @@ QUnit.module("spreadsheet > list plugin", {}, () => {
|
||||
spreadsheetData,
|
||||
mockRPC: function (route, args) {
|
||||
if (args.method === "search_read") {
|
||||
assert.deepEqual(args.kwargs.domain, [["foo", "=", 7]]);
|
||||
assert.deepEqual(args.kwargs.domain, [["foo", "=", uid]]);
|
||||
assert.step("search_read");
|
||||
}
|
||||
},
|
||||
|
||||
@@ -537,6 +537,7 @@ QUnit.module("spreadsheet > pivot plugin", {}, () => {
|
||||
});
|
||||
|
||||
QUnit.test("can import (export) contextual domain", async (assert) => {
|
||||
const uid = session.user_context.uid;
|
||||
const spreadsheetData = {
|
||||
pivots: {
|
||||
1: {
|
||||
@@ -554,7 +555,7 @@ QUnit.module("spreadsheet > pivot plugin", {}, () => {
|
||||
spreadsheetData,
|
||||
mockRPC: function (route, args) {
|
||||
if (args.method === "read_group") {
|
||||
assert.deepEqual(args.kwargs.domain, [["foo", "=", 7]]);
|
||||
assert.deepEqual(args.kwargs.domain, [["foo", "=", uid]]);
|
||||
assert.step("read_group");
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user