You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.9 KiB

6 years ago
  1. ###################################################################################
  2. #
  3. # Copyright (C) 2017 MuK IT GmbH
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU Affero General Public License as
  7. # published by the Free Software Foundation, either version 3 of the
  8. # License, or (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU Affero General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU Affero General Public License
  16. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. #
  18. ###################################################################################
  19. import os
  20. import logging
  21. from urllib.parse import urlunparse
  22. from urllib.parse import urlparse
  23. from urllib.parse import parse_qsl
  24. from urllib.parse import urlencode
  25. from odoo.tests import common
  26. _path = os.path.dirname(os.path.dirname(__file__))
  27. _logger = logging.getLogger(__name__)
  28. class ReStructuredTextParseTestCase(common.HttpCase):
  29. at_install = False
  30. post_install = True
  31. def setUp(self):
  32. super(ReStructuredTextParseTestCase, self).setUp()
  33. self.sample = self.browse_ref('muk_web_preview_rst.rst_attachment_demo')
  34. def tearDown(self):
  35. super(ReStructuredTextParseTestCase, self).tearDown()
  36. def test_rst(self):
  37. self.authenticate('admin', 'admin')
  38. url = "/web/preview/converter/mail"
  39. params = {'url': "/web/content?id={}".format(self.sample.id)}
  40. url_parts = list(urlparse(url))
  41. query = dict(parse_qsl(url_parts[4]))
  42. query.update(params)
  43. url_parts[4] = urlencode(query)
  44. url = urlunparse(url_parts)
  45. self.assertTrue(self.url_open(url))