Skip to content
Permalink
Browse files

🔥 pass variable

  • Loading branch information...
trojikman committed Jul 8, 2019
1 parent c366793 commit c47c133014773677911635237cb20bdf53c945fb
Showing with 10 additions and 4 deletions.
  1. +10 −4 saas_public/tests/test_saas_public.py
@@ -1,6 +1,8 @@
# Copyright 2019 Denis Mudarisov <https://it-projects.info/team/trojikman>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo.addons.saas.tests.common_saas_test import Common, DB_TEMPLATE_1, DB_TEMPLATE_2
import urllib

from odoo.addons.saas.tests.common_saas_test import Common
from odoo.tests.common import tagged, HttpCase
from odoo.service import db

@@ -25,11 +27,15 @@ def test_saas_public(self):
self.drop_dbs(drop_db_list)
self.env['saas.template.operator'].preparing_template_next()
public_template_id = self.saas_template_1.id
url = '/saas_public/{}/create-fast-build'
public_template = self.url_open(url.format(public_template_id))
params = urllib.parse.urlencode({
'mail_message': 'mail.message',
})
url_1 = '/saas_public/{template_id}/create-fast-build?{params}'.format(template_id=public_template_id, params=params)
public_template = self.url_open(url_1.format(public_template_id))
self.assertIn(public_template.status_code, [200, 204], 'User must be redirected to the build')
created_builds = [build for build in db.list_dbs() if build.startswith('test_fast_build')]
self.assertTrue(created_builds)
private_template_id = self.saas_operator_2.id
private_template = self.url_open(url.format(private_template_id))
url_2 = '/saas_public/{}/create-fast-build'
private_template = self.url_open(url_2.format(private_template_id))
self.assertIn(private_template.status_code, [404, 403], 'User should not have access to a private template')

0 comments on commit c47c133

Please sign in to comment.
You can’t perform that action at this time.