Files
odoo_source/addons/test_spreadsheet/tests/test_spreadsheet.py
T
Rmi Rahir (rar) d0f3341f8d [FIX] spreadsheet: move test to dedicated module
The test added in #120818 was relying on a model that does not depend on
module `spreadsheet, rather the opposite. This information was probably
lost during the forwardport process.

Since the fix concerns `spreadsheet.mixin` and not just
`spreadsheet.dashboard`, it makes sense to test it globally, in a
dedicated test module.

Fixes runbot build errors 20966 and 20968

closes odoo/odoo#123947

X-original-commit: 7205e3b26eb3de3f53d6984cd07ec3e4b3fbcfdd
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2023-06-07 21:34:40 +02:00

13 lines
570 B
Python

import base64
import json
from odoo.tests.common import TransactionCase, Form
from odoo.exceptions import ValidationError
class ValidateSpreadsheetMixinData(TransactionCase):
def test_onchange_json_data(self):
spreadsheet_form = Form(self.env["spreadsheet.test"])
spreadsheet_form.spreadsheet_binary_data = base64.b64encode(json.dumps({'key': 'value'}).encode('utf-8'))
with self.assertRaises(ValidationError, msg='Invalid JSON Data'):
spreadsheet_form.spreadsheet_binary_data = base64.b64encode('invalid json'.encode('utf-8'))