mirror of
https://github.com/odoo/runbot.git
synced 2025-03-30 23:05:44 +07:00
[IMP] runbot: add tests for web_search_read
This commit is contained in:
parent
0dadb4db72
commit
e4c5e64574
@ -15,3 +15,4 @@ from . import test_commit
|
|||||||
from . import test_upgrade
|
from . import test_upgrade
|
||||||
from . import test_dockerfile
|
from . import test_dockerfile
|
||||||
from . import test_host
|
from . import test_host
|
||||||
|
from . import test_web_search_read
|
||||||
|
32
runbot/tests/test_web_search_read.py
Normal file
32
runbot/tests/test_web_search_read.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import json
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from unittest.mock import patch, mock_open
|
||||||
|
|
||||||
|
from odoo.tests.common import Opener, tagged, HttpCase, new_test_user
|
||||||
|
from .common import RunbotCase
|
||||||
|
|
||||||
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@tagged('-at_install', 'post_install')
|
||||||
|
class TestWebsearchReadAccess(RunbotCase, HttpCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
create_context = {'no_reset_password': True, 'mail_create_nolog': True, 'mail_create_nosubscribe': True, 'mail_notrack': True}
|
||||||
|
self.simple_user = new_test_user(self.env, login='simple', name='simple', password='simple', context=create_context)
|
||||||
|
|
||||||
|
def test_user_token(self):
|
||||||
|
poster = Opener(self.cr)
|
||||||
|
res = poster.post(
|
||||||
|
'http://127.0.0.1:8069/runbot/api/web_search_read',
|
||||||
|
data={
|
||||||
|
'uid': 711675,
|
||||||
|
'domain': json.dumps([('id', '=', 1)]),
|
||||||
|
'model': 'runbot.bundle',
|
||||||
|
'specification': json.dumps({'name':{}})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(res.status_code, 403, 'A non existing user should get a 403')
|
||||||
|
self.assertEqual(res.json(), {'error': 'Unauthorized'})
|
Loading…
Reference in New Issue
Block a user