mirror of
https://github.com/bringout/oca-ocb-test.git
synced 2026-04-22 13:42:03 +02:00
19.0 vanilla
This commit is contained in:
parent
38c6088dcc
commit
d9452d2060
243 changed files with 30797 additions and 10815 deletions
|
|
@ -16,6 +16,12 @@ class WebsiteTest(Home):
|
|||
def test_view(self, **kwargs):
|
||||
return request.render('test_website.test_view')
|
||||
|
||||
@http.route('/test_view_access_error', type='http', auth='public', website=True, sitemap=False)
|
||||
def test_view_access_error(self, **kwargs):
|
||||
public = self.env.ref('base.public_user')
|
||||
record = self.env.ref('test_website.test_model_exposed_record_not_published')
|
||||
return request.render('test_website.test_view_access_error', {'record': record.with_user(public)})
|
||||
|
||||
@http.route('/ignore_args/converteronly/<string:a>', type='http', auth="public", website=True, sitemap=False)
|
||||
def test_ignore_args_converter_only(self, a):
|
||||
return request.make_response(json.dumps(dict(a=a, kw=None)))
|
||||
|
|
@ -42,7 +48,7 @@ class WebsiteTest(Home):
|
|||
|
||||
@http.route('/multi_company_website', type='http', auth="public", website=True, sitemap=False)
|
||||
def test_company_context(self):
|
||||
return request.make_response(json.dumps(request.context.get('allowed_company_ids')))
|
||||
return request.make_response(json.dumps(request.env.context.get('allowed_company_ids')))
|
||||
|
||||
@http.route('/test_lang_url/<model("res.country"):country>', type='http', auth='public', website=True, sitemap=False)
|
||||
def test_lang_url(self, **kwargs):
|
||||
|
|
@ -50,7 +56,7 @@ class WebsiteTest(Home):
|
|||
|
||||
# Test Session
|
||||
|
||||
@http.route('/test_get_dbname', type='json', auth='public', website=True, sitemap=False)
|
||||
@http.route('/test_get_dbname', type='jsonrpc', auth='public', website=True, sitemap=False)
|
||||
def test_get_dbname(self, **kwargs):
|
||||
return request.env.cr.dbname
|
||||
|
||||
|
|
@ -64,7 +70,7 @@ class WebsiteTest(Home):
|
|||
def test_user_error_http(self, **kwargs):
|
||||
raise UserError("This is a user http test")
|
||||
|
||||
@http.route('/test_user_error_json', type='json', auth='public', website=True, sitemap=False)
|
||||
@http.route('/test_user_error_json', type='jsonrpc', auth='public', website=True, sitemap=False)
|
||||
def test_user_error_json(self, **kwargs):
|
||||
raise UserError("This is a user rpc test")
|
||||
|
||||
|
|
@ -72,11 +78,11 @@ class WebsiteTest(Home):
|
|||
def test_validation_error_http(self, **kwargs):
|
||||
raise ValidationError("This is a validation http test")
|
||||
|
||||
@http.route('/test_validation_error_json', type='json', auth='public', website=True, sitemap=False)
|
||||
@http.route('/test_validation_error_json', type='jsonrpc', auth='public', website=True, sitemap=False)
|
||||
def test_validation_error_json(self, **kwargs):
|
||||
raise ValidationError("This is a validation rpc test")
|
||||
|
||||
@http.route('/test_access_error_json', type='json', auth='public', website=True, sitemap=False)
|
||||
@http.route('/test_access_error_json', type='jsonrpc', auth='public', website=True, sitemap=False)
|
||||
def test_access_error_json(self, **kwargs):
|
||||
raise AccessError("This is an access rpc test")
|
||||
|
||||
|
|
@ -84,7 +90,7 @@ class WebsiteTest(Home):
|
|||
def test_access_error_http(self, **kwargs):
|
||||
raise AccessError("This is an access http test")
|
||||
|
||||
@http.route('/test_missing_error_json', type='json', auth='public', website=True, sitemap=False)
|
||||
@http.route('/test_missing_error_json', type='jsonrpc', auth='public', website=True, sitemap=False)
|
||||
def test_missing_error_json(self, **kwargs):
|
||||
raise MissingError("This is a missing rpc test")
|
||||
|
||||
|
|
@ -92,7 +98,7 @@ class WebsiteTest(Home):
|
|||
def test_missing_error_http(self, **kwargs):
|
||||
raise MissingError("This is a missing http test")
|
||||
|
||||
@http.route('/test_internal_error_json', type='json', auth='public', website=True, sitemap=False)
|
||||
@http.route('/test_internal_error_json', type='jsonrpc', auth='public', website=True, sitemap=False)
|
||||
def test_internal_error_json(self, **kwargs):
|
||||
raise werkzeug.exceptions.InternalServerError()
|
||||
|
||||
|
|
@ -100,7 +106,7 @@ class WebsiteTest(Home):
|
|||
def test_internal_error_http(self, **kwargs):
|
||||
raise werkzeug.exceptions.InternalServerError()
|
||||
|
||||
@http.route('/test_access_denied_json', type='json', auth='public', website=True, sitemap=False)
|
||||
@http.route('/test_access_denied_json', type='jsonrpc', auth='public', website=True, sitemap=False)
|
||||
def test_denied_error_json(self, **kwargs):
|
||||
raise AccessDenied("This is an access denied rpc test")
|
||||
|
||||
|
|
@ -131,7 +137,7 @@ class WebsiteTest(Home):
|
|||
return 'Basic Controller Content'
|
||||
|
||||
# Test Redirects
|
||||
@http.route(['/test_website/country/<model("res.country"):country>'], type='http', auth="public", website=True, sitemap=False)
|
||||
@http.route(['/test_website/country/<model("res.country"):country>'], type='http', auth="public", website=True, sitemap=True)
|
||||
def test_model_converter_country(self, country, **kw):
|
||||
return request.render('test_website.test_redirect_view', {'country': country})
|
||||
|
||||
|
|
@ -141,6 +147,16 @@ class WebsiteTest(Home):
|
|||
|
||||
@http.route(['/test_website/model_item/<int:record_id>'], type='http', methods=['GET'], auth="public", website=True, sitemap=False)
|
||||
def test_model_item(self, record_id):
|
||||
record = request.env['test.model'].browse(record_id)
|
||||
values = {
|
||||
'record': record,
|
||||
'main_object': record,
|
||||
'tag': record.tag_id,
|
||||
}
|
||||
return request.render("test_website.model_item", values)
|
||||
|
||||
@http.route(['/test_website/model_item_sudo/<int:record_id>'], type='http', methods=['GET'], auth="public", website=True, sitemap=False)
|
||||
def test_model_item_sudo(self, record_id):
|
||||
values = {
|
||||
'record': request.env['test.model'].sudo().browse(record_id),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue