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.

55 lines
2.0 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 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. import unittest
  22. from urllib.parse import urlunparse
  23. from urllib.parse import urlparse
  24. from urllib.parse import parse_qsl
  25. from urllib.parse import urlencode
  26. from odoo.tests import common
  27. _path = os.path.dirname(os.path.dirname(__file__))
  28. _logger = logging.getLogger(__name__)
  29. class ReStructuredTextParseTestCase(common.HttpCase):
  30. at_install = False
  31. post_install = True
  32. def setUp(self):
  33. super(ReStructuredTextParseTestCase, self).setUp()
  34. self.sample = self.browse_ref('muk_web_preview_rst.rst_attachment_demo')
  35. def tearDown(self):
  36. super(ReStructuredTextParseTestCase, self).tearDown()
  37. @unittest.skip("HTTP")
  38. def test_rst(self):
  39. self.authenticate('admin', 'admin')
  40. url = "/web/preview/rst"
  41. params = {'url': "/web/content?id={}".format(self.sample.id)}
  42. url_parts = list(urlparse(url))
  43. query = dict(parse_qsl(url_parts[4]))
  44. query.update(params)
  45. url_parts[4] = urlencode(query)
  46. url = urlunparse(url_parts)
  47. self.assertTrue(self.url_open(url))